ELC
ELC-lang
载入中...
搜索中...
未找到
all_defs.cpp
1#line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
2//all
3//at namespace ::
4/*
5未完成的elc解释器include文件
6由steve02081504与Alex0125设计、编写
7转载时请在不对此文件做任何修改的同时注明出处
8项目地址:https://github.com/steve02081504/ELC
9*/
10//tool reg : \n[^\n]+\d+ (\S+)\n -> \n\t#include \"\1\"\n
11#if !defined(ELC_ALL)
12 #define ELC_ALL
13 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
14 //base
15 //at namespace ::
16 /*
17 未完成的elc解释器include文件
18 由steve02081504与Alex0125设计、编写
19 转载时请在不对此文件做任何修改的同时注明出处
20 项目地址:https://github.com/steve02081504/ELC
21 */
22 #if !defined(ELC_BASE)
23 #define ELC_BASE
24 //原base的一小部分,但由于过于底层,底层到API定义都需要使用。。
25 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
26 //base_defs
27 //at namespace ::
28 /*
29 未完成的elc解释器include文件
30 由steve02081504与Alex0125设计、编写
31 转载时请在不对此文件做任何修改的同时注明出处
32 项目地址:https://github.com/steve02081504/ELC
33 */
34 #if !defined(ELC_BASE_DEFS)
35 #define ELC_BASE_DEFS
36 #define __builtin_is_my_dick_still_there() true
37 #include <cstddef>//nullptr_t
38 #include <cstdlib>//exit、size_t
39 #include <new>//operator new(T*)、launder
40 #include <algorithm>//max、min
41 #include <type_traits>//enable_if等
42 #include <typeinfo>//RTTI
43 #include <cmath>//sqrt
44 #include <cfenv>//rounding
45 #include <ranges>
46 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/_body.hpp"
47 //_body.hpp
48 //at namespace ::
49 /*
50 未完成的elc解释器base_defs文件
51 由steve02081504与Alex0125设计、编写
52 转载时请在不对此文件做任何修改的同时注明出处
53 项目地址:https://github.com/steve02081504/ELC
54 */
55 //include default_data_type:基础数据类型定义
56 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/default_data_type.hpp"
57 //default_data_type.hpp
58 /*
59 未完成的elc解释器_share文件
60 由steve02081504与Alex0125设计、编写
61 转载时请在不对此文件做任何修改的同时注明出处
62 项目地址:https://github.com/steve02081504/ELC
63 */
64 namespace elc{
65 /*ELC内部string统一采用char_t宽字符,使用setlocale(LC_ALL,"en_US.utf8")下的UTF编码。*/
66 typedef char32_t char_t;
67 /*ELC内部钦定int_t类型*/
68 typedef int64_t int_t;
69 /*ELC内部钦定uint_t类型*/
70 typedef uint64_t uint_t;
71 /*ELC内部钦定float_t类型*/
72 typedef double float_t;
73 /*ELC内部钦定float_size_t类型,用以描述内存大小的浮点状况*/
74 typedef long double float_size_t;
75 }
76
77 //file_end
78
79 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/_body.hpp"
80 namespace elc::defs{ //在elc::defs中定义内容
81 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
82 //_defs.hpp
83 /*
84 未完成的elc解释器basic文件
85 由steve02081504与Alex0125设计、编写
86 转载时请在不对此文件做任何修改的同时注明出处
87 项目地址:https://github.com/steve02081504/ELC
88 */
89 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
90 //_defs.hpp
91 /*
92 未完成的elc解释器_share文件
93 由steve02081504与Alex0125设计、编写
94 转载时请在不对此文件做任何修改的同时注明出处
95 项目地址:https://github.com/steve02081504/ELC
96 */
97
98 //undefs at "_undefs.hpp"
99
100 //set ELC_WARNING_LEVEL default to 4(max)
101 #if !defined(ELC_WARNING_LEVEL)
102 #define ELC_WARNING_LEVEL 4
103 #endif
104
105 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
106 //basic_environment.hpp
107 /*
108 未完成的elc解释器_share文件
109 由steve02081504与Alex0125设计、编写
110 转载时请在不对此文件做任何修改的同时注明出处
111 项目地址:https://github.com/steve02081504/ELC
112 */
113
114 //每个bit(不是字节)的可能性
115 //为什么c艹委员会不定义这个?
116 #define BIT_POSSIBILITY 2
117
118 //file_end
119
120 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
121
122 #if defined(_MSC_VER)
123 #pragma warning(push,ELC_WARNING_LEVEL)
124 #pragma warning(disable:4099)//class与struct混用警告diss
125 #pragma warning(disable:26812)//enum class安利diss.
126 #pragma warning(disable:4584)//重复子类警告diss
127 #pragma warning(disable:4250)//域控制继承警告diss
128 #pragma warning(disable:26432)//不完全默认方法警告diss
129 #pragma warning(disable:26435)//virtual override方法警告diss
130 #pragma warning(disable:26481)//容器安利diss
131 #pragma warning(disable:26446)//gsl::at安利diss
132 #pragma warning(disable:26434)//方法覆盖警告diss
133 #pragma warning(disable:26429)//gsl::not_null安利diss
134 #pragma warning(disable:26471)//对void*进行static_cast安利diss
135 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
136 #pragma warning(disable:26473)//相同指针显式cast警告diss
137 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
138 #pragma warning(disable:26485)//数组作指针警告diss
139 #pragma warning(disable:26490)//reinterpret_cast警告diss
140 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
141 #pragma warning(disable:26482)//非常数数组索引警告diss
142 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
143 #endif
144 #if defined(_MSC_VER)
145 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
146 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
147 #define push_msvc_warning() __pragma(warning(push))
148 #define pop_msvc_warning() __pragma(warning(pop))
149 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
150 #else
151 #define suppress_msvc_warning(...)
152 #define disable_msvc_warning(...)
153 #define push_msvc_warning()
154 #define pop_msvc_warning()
155 #define push_and_disable_msvc_warning(...)
156 #endif
157 //
158 #if defined(ELC_VOID_NAME)
159 #undef void
160 #endif
161
162 // #define often_noexcept
163 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
164 #define noexcept_as_auto MAGIC//哦现在有了
165 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
166 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
167
168 #define using_method_from_base_t(name,...) \
169 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
170 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
171 {\
172 return base_t::name(forward<Args>(rest)...);\
173 }\
174
175 #define using_method_from_value(name,value_name,...) \
176 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
177 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
178 {\
179 return value_name.name(forward<Args>(rest)...);\
180 }\
181
182 #define floop while(__builtin_is_my_dick_still_there())
183 #define enable_adl(name) void name()noexcept=delete
184
185 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
186 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
187
188 #define declvalue(...) (::std::declval<__VA_ARGS__>())
189
190 /*实例化到此将引发错误*/
191 #define template_error(reason) static_assert(template_error_helper<T>,reason)
192 /*实例化到此将引发警告*/
193 #define template_warning(reason) template_warning_helper<T>(reason)
194
195 //for type_info
196 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
197 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
198
199 #define is_common_attribute(name) public attribute<T,name<T>>
200 #define is_special_attribute(name) public attribute<T,name>
201
202 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
203 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
204
205 //for float_size_t
206 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
207 //bitnum_of
208 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
209
210 //for attribute
211 #define def_common_attribute_with_nothing(name) \
212 template<typename T>\
213 class name{}\
214
215 #define def_special_attribute_with_nothing(name) \
216 class name{}\
217
218 #define common_attribute_t template<class>class
219 #define special_attribute_t class
220
221 /*
222 若参数的布尔值为零,那么此模板不会实例化
223
224 为什么不用cpp20的constraints?
225 1.不能类内定义
226 2.不能作为模板参数
227 一句话总结:c艹标准会sb
228 */
229 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
230 /*默认参与模板候选*/
231 #define enabled_by_default class enable_state=void
232 /*默认不参与模板候选*/
233 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
234 /*若参数为病式,那么此模板不会实例化*/
235 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
236 /*用于模板声明*/
237 #define enable_flag class enable_state
238
239 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
240 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
241 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
242 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
243 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
244
245 /*让lambda递归更加美观*/
246 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
247 /*让lambda递归更加美观*/
248 #define get_recursive_lambda_caller(name) \
249 lambda_with_catch(&)(auto&&...Args){\
250 return name(name,Args...);\
251 }
252 /*让lambda定义更加美观*/
253 #define lambda []
254 /*让lambda定义更加美观*/
255 #define lambda_with_catch(...) [__VA_ARGS__]
256 /*让lambda递归更加美观*/
257 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
258 //recursive_lambda_self_referential_reserved_symbolname
259 #define lambda_RLSRRS _my_jb_super_sb_name_
260
261 #define MAGIC//ahh,ko no tenno da!
262
263 /*装饰性语法糖*/
264 #define nothing
265
266 /*aya风格语法糖*/
267 #define elseif else if
268 /*aya风格语法糖*/
269 #define _big_than_ >
270 /*aya风格语法糖*/
271 #define _small_than_ <
272
273 #if defined(_MSC_VER)
274 #define not !
275 #define and &&
276 #define or ||
277 #endif
278
279 /*进入名称空间,并不是很美观*/
280 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
281 /*退出名称空间,并不是很美观*/
282 #define BREAK_NAMESPACE }
283
284 /*template说明符*/
285 #define template_name template
286 /*template说明符*/
287 #define type_name class
288
289 #if defined(DEBUG) || defined(_DEBUG)
290 #define not_in_debug 0
291 #else
292 #define not_in_debug 1
293 #endif
294
295 #define es U""
296 #define ec(ch) U ## ch
297
298 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
299 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
300 #else
301 #define ELC_TEST_EVENTNAME(name)
302 #endif
303
304 #define override_instance_struct \
305 protected:\
306 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
307 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
308 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
309 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
310 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
311
312 #if defined(_WIN32)
313 #define distinctive __declspec(dllexport)
314 #else
315 #define distinctive
316 #endif
317
318 #if defined(_WIN32)
319 #define force_inline __forceinline
320 #elif defined(__GNUC__)
321 #define force_inline __attribute__((always_inline)) inline
322 #else
323 #define force_inline inline
324 #endif
325
326 #if defined(_WIN32)
327 #define with_no_vtable __declspec(novtable)
328 #else
329 #define with_no_vtable
330 #endif
331
332 #define in_consteval (::std::is_constant_evaluated())
333
334 #define no_vtable_struct struct with_no_vtable
335 #define no_vtable_class class with_no_vtable
336
337 //file_end
338
339 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
340
341 //file_end
342
343 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/_body.hpp"
344
345 namespace base{}
346 using namespace base;//导出内容:defs内的名称空间只起到大体名称分组的作用,不进行名称阻拦
347
348 //内存泄露检测
349 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
350 namespace memory{
351 inline void check_memory_lack()noexcept;
352 inline struct distinctive memory_lack_checker_t{
353 ~memory_lack_checker_t(){
354 check_memory_lack();
355 }
356 }memory_lack_checker{};
357 }
358 #endif
359
360 namespace base{
361 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
362 //_body.hpp
363 //at namespace elc::defs::base
364 /*
365 未完成的elc解释器base_defs文件
366 由steve02081504与Alex0125设计、编写
367 转载时请在不对此文件做任何修改的同时注明出处
368 项目地址:https://github.com/steve02081504/ELC
369 */
370 //恭喜你找到elc内大部分语法糖所在地
371 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/template_helper.hpp"
372 //template_helper.hpp
373 //at namespace elc::defs::base
374 /*
375 未完成的elc解释器base_defs文件
376 由steve02081504与Alex0125设计、编写
377 转载时请在不对此文件做任何修改的同时注明出处
378 项目地址:https://github.com/steve02081504/ELC
379 */
380 /*
381 宏辅助,用以补全元编程错误宏template_error的内容.
382 */
383 template<class T>
384 constexpr bool template_error_helper=1000-7==114514;//w.
385 /*
386 宏辅助,用以补全元编程错误宏template_warning的内容.
387 */
388 template<class T,class U>
389 [[deprecated("this was a template warning."),nodiscard]]
390 inline auto template_warning_helper(U&&a)noexcept{return 0;}
391
392 //file_end
393
394 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
395 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/using_std.hpp"
396 //using_std.hpp
397 //at namespace elc::defs::base
398 /*
399 未完成的elc解释器base_defs文件
400 由steve02081504与Alex0125设计、编写
401 转载时请在不对此文件做任何修改的同时注明出处
402 项目地址:https://github.com/steve02081504/ELC
403 */
404 //从std中导入一些名称.
405 //这不比博人传燃?
406 using ::std::byte;
407 using ::std::size_t;
408
409 using ::std::forward;
410 using ::std::addressof;
411 using ::std::swap;
412 /*
413 如何不用中间变量swap两个值?
414 方法一:
415 a=a+b
416 b=a-b
417 a=a-b
418 方法二:
419 a^=b^=a^=b
420 道理我都懂,可是还是用中间变量快些
421 XD
422 更多方法欢迎补充
423 */
424
425 template<class T>
426 using remove_cvref= ::std::remove_cvref_t<T>;
427 template<class T>
428 using remove_cv= ::std::remove_cv_t<T>;
429 template<class T>
430 using remove_ref= ::std::remove_reference_t<T>;
431 template<bool B,class T,class F>
432 using conditional= ::std::conditional_t<B,T,F>;
433 //
434 using ::std::partial_ordering;
435 using ::std::weak_ordering;
436 using ::std::strong_ordering;
437
438 //file_end
439
440 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
441 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/concept.hpp"
442 //concept.hpp
443 //at namespace elc::defs::base
444 /*
445 未完成的elc解释器base_defs文件
446 由steve02081504与Alex0125设计、编写
447 转载时请在不对此文件做任何修改的同时注明出处
448 项目地址:https://github.com/steve02081504/ELC
449 */
450 //template<typename T,template<typename>constexpr bool name>
451 //concept as_concept=name<T>;
452
453 //file_end
454
455 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
456 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/magic_number.hpp"
457 //magic_number.hpp
458 //at namespace elc::defs::base
459 /*
460 未完成的elc解释器base_defs文件
461 由steve02081504与Alex0125设计、编写
462 转载时请在不对此文件做任何修改的同时注明出处
463 项目地址:https://github.com/steve02081504/ELC
464 */
465 namespace magic_number{
466 /*
467 黄金分割比
468 数理逻辑不应通过强奸感性来定义审美.
469 我们应当遵从物体的自身结构,辅助线仅能在这基础上起到梳理作用,并不能以此作为创作起点来表达情感,它仅存于外部世界,无法到达内心.
470 黄金分割并不万能.
471 */
472 constexpr auto gold=0.61803398874989484820458683436563811772030917980576286213544862270526046281890244970720720418939113748475408807538689175212663386222353693179318006076672635443338908659593958290563832266131992829026788067520876689250171169620703222104321626954862629631361443814975870122034080588795445474924618569536486444924104432077134494704956584678850987433944221254487706647809158846074998871240076521705751797883416625624940758906970400028121042762177111777805315317141011704666599146697987317613560067087480710131795236894275219484353056783002287856997829778347845878228911097625003026961561700250464338243776486102838312683303724292675263116533924731671112115881863851331620384005222165791286675294654906811317159934323597349498509040947621322298101726107059611645629909816290555208524790352406020172799747175342777592778625619432082750513121815628551222480939471234145170223735805772786160086883829523045926478780178899219902707769038953219681986151437803149974110692608867429622675756052317277752035361393621076738937645560606059216589466759551900400555908950229530942312482355212212415444006470340565734797663972394949946584578873039623090375033993856210242369025138680414577995698122445747178034173126453220416397232134044449487302315417676893752103068737880344170093954409627955898678723209512426893557309704509595684401755519881921802064052905518934947592600734852282101088194644544222318891319294689622002301443770269923007803085261180754519288770502109684249362713592518760777884665836150238913493333122310533923213624319263728910670503399282265263556209029798642472759772565508615487543574826471814145127000602389016207773224499435308899909501680328112194320481964387675863314798571911397815397807476150772211750826945863932045652098969855567814106968372884058746103378105444390943683583581381131168993855576975484149144534150912954070050194775486163075422641729394680367319805861833918328599130396072014455950449779212076124785645916160837059498786006970189409886400764436170933417270919143365013715;//精度2000(然而只是double而已.)
473
474 /*每次扩容后的空间与原空间为这样的比值可以最小化时空负担,是的,以一种较为艺术的比值.*/
475 constexpr auto gold_of_resize=gold+1;//精度2000——大概
476
477 /*圆周率.*/
478 constexpr auto pi = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778185778053217122680661300192787661119590921642019893809525720106548586327886593615338182796823030195203530185296899577362259941389124972177528347913151557485724245415069595082953311686172785588907509838175463746493931925506040092770167113900984882401285836160356370766010471018194295559619894676783744944825537977472684710404753464620804668425906949129331367702898915210475216205696602405803815019351125338243003558764024749647326391419927260426992279678235478163600934172164121992458631503028618297455570674983850549458858692699569092721079750930295532116534498720275596023648066549911988183479775356636980742654252786255181841757467289097777279380008164706001614524919217321721477235014144197356854816136115735255213347574184946843852332390739414333454776241686251898356948556209921922218427255025425688767179049460165346680498862723279178608578438382796797668145410095388378636095068006422512520511739298489608412848862694560424196528502221066118630674427862203919494504712371378696095636437191728746776465757396241389086583264599581339047802759009;//精度2000
479
480 /*自然对数的底数.*/
481 constexpr auto e = 2.71828182845904523536028747135266249775724709369995957496696762772407663035354759457138217852516642742746639193200305992181741359662904357290033429526059563073813232862794349076323382988075319525101901157383418793070215408914993488416750924476146066808226480016847741185374234544243710753907774499206955170276183860626133138458300075204493382656029760673711320070932870912744374704723069697720931014169283681902551510865746377211125238978442505695369677078544996996794686445490598793163688923009879312773617821542499922957635148220826989519366803318252886939849646510582093923982948879332036250944311730123819706841614039701983767932068328237646480429531180232878250981945581530175671736133206981125099618188159304169035159888851934580727386673858942287922849989208680582574927961048419844436346324496848756023362482704197862320900216099023530436994184914631409343173814364054625315209618369088870701676839642437814059271456354906130310720851038375051011574770417189861068739696552126715468895703503540212340784981933432106817012100562788023519303322474501585390473041995777709350366041699732972508868769664035557071622684471625607988265178713419512466520198918006308407507245458379639351364421067750539471789004518357551541252235905906872648786357525419112888773717663748602766063496035367947026923229718683277173932361920077745221262475186983349515101986426988784717193966497690708252174233656627259284406204302141137199227852699846988477023238238400556555178890876613601304770984386116870523105531491625172837327286760072481729876375698163354150746088386636406934704372066886512756882661497307886570156850169186474885416791545965072342877306998537139043002665307839877638503238182155355973235306860430106757608389086270498418885951380910304235957824951439885901131858358406674723702971497850841458530857813391562707603563907639473114554958322669457024941398316343323789759556808568362972538679132750555425244919435891284050452269538121791319145135009938463117740179715122837854601160359554028644059;//精度2000
482
483 constexpr auto god=72;//神已死,神万岁.
484
485 /*符号位查询*/
486 template<typename T> requires ::std::is_arithmetic_v<T>
487 [[nodiscard]]force_inline constexpr bool is_negative(T x)noexcept{
488 if constexpr(::std::is_signed_v<T>){
489 if constexpr(::std::is_floating_point_v<T>)
490 return ::std::signbit(x);
491 else
492 return x<0;
493 }
494 else
495 return false;
496 }
497 /*符号位设置*/
498 template<typename T> requires ::std::is_arithmetic_v<T>
499 [[nodiscard]]force_inline constexpr T copy_as_negative(auto x,bool negative=1)noexcept{
500 if constexpr(::std::is_signed_v<decltype(x)>){
501 if constexpr(::std::is_floating_point_v<decltype(x)>)
502 return(T)::std::copysign(x,negative?-1:1);
503 else
504 return(T)negative?T{}-x:x;
505 }
506 else
507 return x;
508 }
509 [[nodiscard]]force_inline constexpr auto copy_as_negative(auto x,bool negative=1)noexcept{
510 return copy_as_negative<decltype(x)>(x,negative);
511 }
512 /*任意算数类型转size_t*/
513 template<typename T> requires ::std::is_arithmetic_v<T>
514 [[nodiscard]]force_inline constexpr size_t to_size_t(T x)noexcept{
515 if constexpr(::std::is_floating_point_v<T>)
516 return (size_t)(ptrdiff_t)x;
517 else
518 return (size_t)x;
519 }
520 /*任意算数类型转uintmax_t*/
521 template<typename T> requires ::std::is_arithmetic_v<T>
522 [[nodiscard]]force_inline constexpr ::std::uintmax_t to_uintmax_t(T x)noexcept{
523 if constexpr(::std::is_floating_point_v<T>)
524 return (::std::uintmax_t)(::std::intmax_t)x;
525 else
526 return (::std::uintmax_t)x;
527 }
528 /*求余*/
529 template<typename T1,typename T2> requires ::std::is_arithmetic_v<T1> and ::std::is_arithmetic_v<T2>
530 [[nodiscard]]force_inline constexpr auto mod(T1 a,T2 b){
531 if constexpr(::std::is_floating_point_v<T1>||::std::is_floating_point_v<T2>)
532 return ::std::fmod(a,b);
533 else
534 return a%b;
535 }
536 /*设置浮点舍入*/
537 template<typename T>
538 [[nodiscard]]force_inline constexpr void set_rounding(int mode){
539 if constexpr(::std::is_floating_point_v<T>)
540 ::std::fesetround(mode);
541 }
542 /*获取浮点舍入*/
543 template<typename T>
544 [[nodiscard]]force_inline constexpr int get_rounding(){
545 if constexpr(::std::is_floating_point_v<T>)
546 return ::std::fegetround();
547 else
548 return 0;
549 }
550 /*设置并自动恢复浮点舍入*/
551 template<typename T>
553 int old_rounding;
554 rounding_auto_setter(int new_rounding){
555 old_rounding=get_rounding<T>();
556 set_rounding<T>(new_rounding);
557 }
559 set_rounding<T>(old_rounding);
560 }
561 };
562 //位操作:循环左移(无mod)
563 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
564 template<class T> requires ::std::is_unsigned_v<T>
565 [[nodiscard]]force_inline constexpr auto rotl_nomod(const T v,const auto R)noexcept;
566 //位操作:循环右移(无mod)
567 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
568 template<class T> requires ::std::is_unsigned_v<T>
569 [[nodiscard]]force_inline constexpr auto rotr_nomod(const T v,const auto r)noexcept{
570 constexpr auto d = ::std::numeric_limits<T>::digits;
571 if constexpr(::std::is_unsigned_v<decltype(r)>){
572 if(r)
573 return static_cast<T>(static_cast<T>(v >> r) | static_cast<T>(v << (d - r)));
574 else
575 return v;
576 }
577 else{
578 if(r>0)
579 return static_cast<T>(static_cast<T>(v >> r) | static_cast<T>(v << (d - r)));
580 elseif(r==0)
581 return v;
582 else//r<0
583 return rotl_nomod(v,0-r);
584 }
585 }
586 //位操作:循环左移(无mod)
587 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
588 template<class T> requires ::std::is_unsigned_v<T>
589 [[nodiscard]]force_inline constexpr auto rotl_nomod(const T v,const auto r)noexcept{
590 constexpr auto d = ::std::numeric_limits<T>::digits;
591 if constexpr(::std::is_unsigned_v<decltype(r)>){
592 if(r)
593 return static_cast<T>(static_cast<T>(v << r) | static_cast<T>(v >> (d - r)));
594 else
595 return v;
596 }
597 else{
598 if(r>0)
599 return static_cast<T>(static_cast<T>(v << r) | static_cast<T>(v >> (d - r)));
600 elseif(r==0)
601 return v;
602 else//r<0
603 return rotr_nomod(v,0-r);
604 }
605 }
606 //位操作:循环右移
607 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
608 template<class T> requires ::std::is_unsigned_v<T>
609 [[nodiscard]]force_inline constexpr auto rotr(const T v,const auto R)noexcept{
610 constexpr auto d = ::std::numeric_limits<T>::digits;
611 const auto r = mod(R,d);
612 return rotr_nomod(v,r);
613 }
614 //位操作:循环左移
615 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
616 template<class T> requires ::std::is_unsigned_v<T>
617 [[nodiscard]]force_inline constexpr auto rotl(const T v,const auto R)noexcept{
618 constexpr auto d = ::std::numeric_limits<T>::digits;
619 const auto r = mod(R,d);
620 return rotl_nomod(v,r);
621 }
622 template<class T> requires ::std::is_arithmetic_v<T>
624 static constexpr auto rot_offset_npos = ::std::numeric_limits<T>::digits;//d
625 size_t _offset;
626 public:
627 force_inline constexpr rot_iterator(size_t offset)noexcept:_offset(offset%rot_offset_npos){}
628 force_inline constexpr rot_iterator&operator++()noexcept{
629 _offset++;
630 if(_offset==rot_offset_npos)
631 _offset=0;
632 return*this;
633 }
634 force_inline constexpr rot_iterator&operator--()noexcept{
635 if(_offset==0)
636 _offset=rot_offset_npos;
637 _offset--;
638 return*this;
639 }
640 force_inline constexpr rot_iterator operator++(int)noexcept{
641 rot_iterator tmp(*this);
642 operator++();
643 return tmp;
644 }
645 force_inline constexpr rot_iterator operator--(int)noexcept{
646 rot_iterator tmp(*this);
647 operator--();
648 return tmp;
649 }
650 [[nodiscard]]force_inline constexpr size_t value()const noexcept{
651 return _offset;
652 }
653 };
654 //位操作:循环左移(无mod)
655 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
656 template<class T> requires ::std::is_unsigned_v<T>
657 [[nodiscard]]force_inline constexpr auto rotl_nomod(const T v,const rot_iterator<T>&r)noexcept{
658 return rotl_nomod(v,r.value());
659 }
660 //位操作:循环右移(无mod)
661 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
662 template<class T> requires ::std::is_unsigned_v<T>
663 [[nodiscard]]force_inline constexpr auto rotr_nomod(const T v,const rot_iterator<T>&r)noexcept{
664 return rotr_nomod(v,r.value());
665 }
666 //位操作:循环左移
667 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
668 template<class T> requires ::std::is_unsigned_v<T>
669 [[nodiscard]]force_inline constexpr auto rotl(const T v,const rot_iterator<T>&r)noexcept{
670 return rotl_nomod(v,r);
671 }
672 //位操作:循环右移
673 //不使用std版本而是自己写的原因:std版本右操作数只能是int而不能是size_t或别的,标准会傻逼
674 template<class T> requires ::std::is_unsigned_v<T>
675 [[nodiscard]]force_inline constexpr auto rotr(const T v,const rot_iterator<T>&r)noexcept{
676 return rotr_nomod(v,r);
677 }
678 //abs
679 template<class T> requires ::std::is_arithmetic_v<T>
680 [[nodiscard]]force_inline constexpr auto abs(const T v)noexcept{
681 if constexpr(::std::is_signed_v<T>)
682 return v>=0?v:-v;
683 else
684 return v;
685 }
686 //feq
687 template<class T> requires ::std::is_arithmetic_v<T>
688 [[nodiscard]]force_inline constexpr bool feq(const T a,const T b)noexcept{
689 return abs(a-b)<=::std::numeric_limits<T>::epsilon();
690 }
691 //sub
692 template<class T1,class T2> requires was_not_an_ill_form(declvalue(T1)-declvalue(T2))
693 [[nodiscard]]force_inline constexpr auto sub(const T1 a,const T2 b)noexcept{
694 if constexpr(::std::is_arithmetic_v<T1>&&::std::is_arithmetic_v<T2>){
695 if constexpr(::std::is_floating_point_v<T1>||::std::is_floating_point_v<T2>)
696 return a-b;
697 else{
698 using signedT = ::std::make_signed_t<::std::common_type_t<T1,T2>>;
699 return static_cast<signedT>(a)-static_cast<signedT>(b);
700 }
701 }
702 else
703 return a-b;
704 }
705 //exp
706 //不使用std版本而是自己写的原因:std版本不是constexpr,标准会傻逼
707 template<class T> requires ::std::is_floating_point_v<T>
708 [[nodiscard]]force_inline constexpr T exp(const T v)noexcept{
709 if in_consteval{
710 typedef decltype(::std::exp(v)) RT;
711 auto exp_impl = recursive_lambda(RT x,RT sum,RT n,size_t i,RT t)noexcept -> RT{
712 const auto epsilon=sum+t/n;
713 if(feq(sum,epsilon))
714 return sum;
715 else
716 return self_recursion(x,epsilon,n*i,i+1,t*x);
717 };
718 auto exp_impl_caller = get_recursive_lambda_caller(exp_impl);
719 return exp_impl_caller(RT{v},RT{1},RT{1},2,RT{v});
720 }
721 else
722 return ::std::exp(v);
723 }
724 //log
725 //不使用std版本而是自己写的原因:std版本不是constexpr,标准会傻逼
726 template<class T> requires ::std::is_arithmetic_v<T>
727 [[nodiscard]]force_inline constexpr auto log(const T a)noexcept{
728 if in_consteval{
729 typedef decltype(::std::log(a)) RT;
730 auto log_impl = recursive_lambda(const RT x,const RT y)noexcept -> RT{
731 auto log_iter = lambda(RT x,RT y)noexcept{
732 const auto exp_y = exp(y);
733 return y + T{2}*(x-exp_y)/(x+exp_y);
734 };
735 return RT(feq(y,log_iter(x,y)) ? y : self_recursion(x,log_iter(x,y)));
736 };
737 auto log_impl_caller = get_recursive_lambda_caller(log_impl);
738 return log_impl_caller((RT)a,RT{0});
739 }
740 else
741 return ::std::log(a);
742 }
743 template<class T,class U> requires ::std::is_arithmetic_v<T> && ::std::is_arithmetic_v<U>
744 [[nodiscard]]force_inline constexpr auto log(const T a,const U b)noexcept{
745 return log(a)/log(b);
746 }
747 //pow
748 //不使用std版本而是自己写的原因:std版本不是constexpr,标准会傻逼
749 template<class T,class U> requires (::std::is_arithmetic_v<T> && ::std::is_arithmetic_v<U>)
750 [[nodiscard]]force_inline constexpr auto pow(const T a,const U b)noexcept{
751 if in_consteval{
752 typedef decltype(::std::pow(a,b)) RT;
753 return exp(RT(b)*log(RT(a)));
754 }
755 else
756 return ::std::pow(a,b);
757 }
758 //trunc
759 //不使用std版本而是自己写的原因:std版本不是constexpr,标准会傻逼
760 template<class T> requires ::std::is_floating_point_v<T>
761 [[nodiscard]]force_inline constexpr auto trunc(const T v)noexcept{
762 if in_consteval{
763 typedef decltype(::std::trunc(v)) RT;
764 return static_cast<RT>((::std::intmax_t)v);
765 }
766 else
767 return ::std::trunc(v);
768 }
769 //ceil
770 //不使用std版本而是自己写的原因:std版本不是constexpr,标准会傻逼
771 template<class T> requires ::std::is_floating_point_v<T>
772 [[nodiscard]]force_inline constexpr auto ceil(const T v)noexcept{
773 if in_consteval{
774 typedef decltype(::std::ceil(v)) RT;
775 auto ceil_impl = lambda(T x, T y)noexcept{
776 return feq(x,y) ? y : y+T{1};
777 };
778 return v<0 ? -static_cast<T>(to_uintmax_t(-v)) : ceil_impl(v,static_cast<T>(to_uintmax_t(v)));
779 }
780 else
781 return ::std::ceil(v);
782 }
783
784 /*判断某数是否是素数*/
785 template<class T> requires ::std::is_arithmetic_v<T>
786 [[nodiscard]]inline constexpr bool is_prime_num(T a)
787 {
788 if constexpr(::std::is_floating_point_v<T>)
789 if(a != ceil(a))
790 return false;
791 /*
792 应某人的要求补注释(都是主人的任务罢了.).
793 */
794 a=abs(a);
795
796 if(a<4)
797 return true;//1和0也是prime,我不管.
798 /*
799 当x≥1,那么≥5的自然数如下:
800 6x-1 6x 6x+1 6x+2 6x+3 6x+4
801 6(x+1)-1 6(x+1) 6(x+1)+1 ... //这已经是下一周期了.
802
803 考虑单个周期:
804 6x+2 6x+3 6x+4 是 2(3x+1) 3(2x+1) 2(3x+2),排除.
805 6x,排除.
806 那么,只用考虑6x±1是否是prime.
807 */
808 if(mod(mod(a,6)-1,4))
809 return false;
810 T b=static_cast<T>(::std::sqrt(a));//若一个数可以分解为两因数之积,其中一个因数必定≤其开方:反指数式减少遍历范围.
811 /*
812 接下来:
813 设要判定的数n(6x±1的缩写).
814 测试数可以看为6i-1 6i 6i+1 6i+2 6i+3 6i+4的其中之一,同样以6为周期.
815 对于测试数的整个周期,其中:
816 如果n能被6i 6i+2 6i+4整除:则n要是偶数,但±1,排除.
817 如果n能被6i+3整除:则n要是3倍数,但±1,排除.
818 综上,循环中只要考虑6i±1的情况.
819 所以以5起始,前进6(自然选择号,前进4!),逐次判断0与+2.
820 虽然很想写成以6为起始逐次判断±1的对称格式但是这样会加重时空负担.(不甘心.....)
821 */
822 for(T c=5;c<=b;c+=6)//遍历判断是否能被因数分解——不会有人看不懂吧?
823 if((!mod(a,c))||(!mod(a,(c+2))))
824 return false;
825 /*
826 最后,为什么是6?
827 就结论来说,此数值选择最常出现的两因数(除0或1外.)之积可以最大程度减少时间占用.
828 所以虽然更喜欢7/8/9之类的数不过使用6收益最大.
829 要不是这样早就写成7了.
830 */
831 return true;
832 /*
833 因为后半段判定没有考虑到≤5的数,所以本函数第一个if进行判定补全.
834 */
835 }
836 //求大于某数的素数
837 template<class T> requires ::std::is_arithmetic_v<T>
838 [[nodiscard]]inline constexpr T get_prime_num_big_or_eq_than(T a){
839 if constexpr(::std::is_floating_point_v<T>)
840 a=ceil(a);
841 while(!is_prime_num(a))
842 a++;
843 return a;
844 }
845 push_and_disable_msvc_warning(26467);//gold_of_resize永远为正数
846 //已知当前array的size,求下一个合适的提前分配大小
847 [[nodiscard]]inline constexpr size_t get_next_gold_size_to_resize_for_array(size_t size){
848 /*
849 每次扩容后的空间与原空间比大致为gold of resize可以最小化时空负担.
850 */
851 return size_t(size*gold_of_resize);
852 }
853 //已知当前hash table的size,求下一个合适的桶大小
854 [[nodiscard]]inline constexpr size_t get_next_gold_size_to_resize_for_hash(size_t size){
855 /*
856 素数大小的桶数可以使hash table中的每个桶尽可能活跃.
857 每次扩容后的空间与原空间比大致为gold of resize可以最小化时空负担.
858 */
859 return size_t(get_prime_num_big_or_eq_than(size*gold_of_resize));
860 }
861 pop_msvc_warning();
862
863 //线性插值.
864 namespace linear_interpolation{
865 [[nodiscard]]inline constexpr auto get_k(auto y1,auto y2,auto δx)noexcept{
866 auto δy=sub(y2,y1);
867 auto k=δy/δx;
868 return k;
869 }
870 [[nodiscard]]inline constexpr auto get_k(auto y1,auto y2)noexcept{
871 return get_k(y1,y2,1.0);
872 }
873 [[nodiscard]]inline constexpr auto get_result(auto y1,auto k,auto δx)noexcept{
874 auto diff=k*δx;
875 return y1+diff;
876 }
877 [[nodiscard]]inline constexpr auto get_reverse_result(auto k,auto δx,auto y)noexcept{
878 auto diff=k*δx;
879 return y-diff;
880 }
881 }
882 }
883 using magic_number::is_negative;
884 using magic_number::copy_as_negative;
885 using magic_number::to_size_t;
886 using magic_number::mod;
887 using magic_number::set_rounding;
888 using magic_number::get_rounding;
889 using magic_number::rounding_auto_setter;
890 using magic_number::rotl;
891 using magic_number::rotr;
892 using magic_number::rotl_nomod;
893 using magic_number::rotr_nomod;
894 using magic_number::rot_iterator;
895 using magic_number::abs;
896 using magic_number::exp;
897 using magic_number::log;
898 using magic_number::pow;
899 using magic_number::ceil;
900 using magic_number::trunc;
901 using magic_number::get_next_gold_size_to_resize_for_array;
902 using magic_number::get_next_gold_size_to_resize_for_hash;
903
904 //file_end
905
906 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
907
908 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/other.hpp"
909 //other.hpp
910 //at namespace elc::defs::base
911 /*
912 未完成的elc解释器base_defs文件
913 由steve02081504与Alex0125设计、编写
914 转载时请在不对此文件做任何修改的同时注明出处
915 项目地址:https://github.com/steve02081504/ELC
916 */
917 class empty_type{};
918
919 template<typename T,typename U>
920 inline auto&assign(T&&a,U&&b)noexcept_as(a=b){//为绕过条件内赋值时の警告而使用
921 a=b;
922 return a;
923 }
924
925 template<typename T>
926 inline void discard(T&&){}//fucking nodiscard.
927 template<typename T>
928 inline void just_a_use(T&&){}
929
930 template<typename T>
931 distinctive inline T const_default_value_of{};//?
932
933 enable_adl(the_destroy);
934 template<typename T>
935 static void destroy(T*a)noexcept{
936 if constexpr(was_not_an_ill_form(the_destroy(a)))
937 the_destroy(a);
938 else
939 template_error("Please overload the function the_destroy in the namespace where this type is defined.");
940 }
941
942 //file_end
943
944 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
945
946 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/cast.hpp"
947 //cast.hpp
948 //at namespace elc::defs::base
949 /*
950 未完成的elc解释器base_defs文件
951 由steve02081504与Alex0125设计、编写
952 转载时请在不对此文件做任何修改的同时注明出处
953 项目地址:https://github.com/steve02081504/ELC
954 */
955 push_and_disable_msvc_warning(
956 26491//down_cast警告diss
957 26466//down_cast警告diss
958 26492//const_cast警告diss
959 );
960 //对值追加const
961 template<typename T>
962 inline constexpr const T add_const(T a)noexcept{return a;}
963 //对引用追加const
964 template<typename T>
965 inline constexpr const T&add_const(T&a)noexcept{return a;}
966 //对引用移除const
967 template<typename T>
968 inline constexpr T&remove_const(const T&a)noexcept{return const_cast<T&>(a);}
969 //对指针追加const
970 template<typename T>
971 inline constexpr const T*add_const(T*a)noexcept{return a;}
972 //对指针移除const
973 template<typename T>
974 inline constexpr T*remove_const(const T*a)noexcept{return ::std::launder(const_cast<T*>(a));}
975 //向下转型至
976 template<typename T,typename U>
977 inline constexpr T down_cast(U a)noexcept{return static_cast<T>(a);}
978 pop_msvc_warning();
979
980 //file_end
981
982 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
983 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/special_flags.hpp"
984 //special_flag.hpp
985 //at namespace elc::defs::base
986 /*
987 未完成的elc解释器base_defs文件
988 由steve02081504与Alex0125设计、编写
989 转载时请在不对此文件做任何修改的同时注明出处
990 项目地址:https://github.com/steve02081504/ELC
991 */
992
993 #define defspecflag(name)\
994 constexpr struct name##_t{} name{}
995
996 defspecflag(never_ref_num_zero);
997 defspecflag(special_init);
998
999 #undef defspecflag
1000
1001 //file_end
1002
1003 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1004 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/non_Xable.hpp"
1005 //non_Xable.hpp
1006 //at namespace elc::defs::base
1007 /*
1008 未完成的elc解释器base_defs文件
1009 由steve02081504与Alex0125设计、编写
1010 转载时请在不对此文件做任何修改的同时注明出处
1011 项目地址:https://github.com/steve02081504/ELC
1012 */
1014 constexpr non_copy_assign_able()noexcept=default;
1015 constexpr non_copy_assign_able(const non_copy_assign_able&)noexcept=default;
1016 constexpr non_copy_assign_able(non_copy_assign_able&&)noexcept=default;
1017 constexpr non_copy_assign_able& operator=(const non_copy_assign_able&)&noexcept=delete;
1018 constexpr non_copy_assign_able& operator=(non_copy_assign_able&&)&noexcept=default;
1019 };
1021 constexpr non_move_assign_able()noexcept=default;
1022 constexpr non_move_assign_able(const non_move_assign_able&)noexcept=default;
1023 constexpr non_move_assign_able(non_move_assign_able&&)noexcept=default;
1024 constexpr non_move_assign_able& operator=(const non_move_assign_able&)&noexcept=default;
1025 constexpr non_move_assign_able& operator=(non_move_assign_able&&)&noexcept=delete;
1026 };
1027
1029
1031 constexpr non_copy_construct_able()=default;
1032 constexpr non_copy_construct_able(const non_copy_construct_able&)=delete;
1034 };
1036 constexpr non_move_construct_able()=default;
1037 constexpr non_move_construct_able(const non_move_construct_able&)=default;
1039 };
1040
1042 constexpr non_default_construct_able()=delete;
1043 };
1044
1047
1048 //file_end
1049
1050 #line 19 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1051 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/attribute.hpp"
1052 //attribute.hpp
1053 //at namespace elc::defs::base
1054 /*
1055 未完成的elc解释器base_defs文件
1056 由steve02081504与Alex0125设计、编写
1057 转载时请在不对此文件做任何修改的同时注明出处
1058 项目地址:https://github.com/steve02081504/ELC
1059 */
1060 template<class T,typename attribute_name>
1062 protected:
1063 template<class U,special_attribute_t another_attribute_name>
1064 friend U*get_handle(attribute<U,another_attribute_name>*)noexcept;
1065 constexpr T*get_handle()noexcept{return down_cast<T*>(down_cast<attribute_name*>(this));}
1066
1067 template<class U,special_attribute_t another_attribute_name>
1068 friend const U*get_handle(const attribute<U,another_attribute_name>*)noexcept;
1069 constexpr const T*get_handle()const noexcept{return down_cast<const T*>(down_cast<const attribute_name*>(this));}
1070 };
1071 template<class T,special_attribute_t attribute_name>
1072 T*get_handle(attribute<T,attribute_name>*a)noexcept{return a->get_handle();}
1073 template<class T,special_attribute_t attribute_name>
1074 const T*get_handle(const attribute<T,attribute_name>*a)noexcept{return a->get_handle();}
1075
1076 template<class T,common_attribute_t attribute_name>
1077 T* get_handle(attribute<T,attribute_name<T>>*a)noexcept{return get_handle<T,attribute_name<T>>(a);}
1078 template<class T,common_attribute_t attribute_name>
1079 const T* get_handle(const attribute<T,attribute_name<T>>*a)noexcept{return get_handle<T,attribute_name<T>>(a);}
1080
1081 template<special_attribute_t attribute_name,class T>
1082 auto attribute_ptr_cast(T*ptr)noexcept{
1083 return static_cast<attribute_name*>(ptr);
1084 }
1085 template<special_attribute_t attribute_name,class T>
1086 auto attribute_ptr_cast(const T* ptr)noexcept{
1087 return static_cast<const attribute_name*>(ptr);
1088 }
1089 template<common_attribute_t attribute_name,class T>
1090 auto attribute_ptr_cast(T*ptr)noexcept{
1091 return attribute_ptr_cast<attribute_name<remove_cvref<T>>>(ptr);
1092 }
1093
1094 template<special_attribute_t attribute_name,class T>
1095 auto& attribute_cast(T&t)noexcept{
1096 return*attribute_ptr_cast<attribute_name>(&t);
1097 }
1098 template<common_attribute_t attribute_name,class T>
1099 auto& attribute_cast(T&t)noexcept{
1100 return*attribute_ptr_cast<attribute_name>(&t);
1101 }
1102
1103 template<special_attribute_t... attribute_names>
1104 struct special_attribute_pack:virtual attribute_names...{
1105 /*兼容用*/
1106 template<class T>
1107 struct on_type:special_attribute_pack<attribute_names>...{};
1108 };
1109 template<common_attribute_t... attribute_names>
1111 template<class T>
1112 struct on_type:attribute_names<T>...{};
1113 };
1114
1115 //file_end
1116
1117 #line 20 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1118 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/special_attribute.hpp"
1119 //special_attribute.hpp
1120 //at namespace elc::defs::base
1121 /*
1122 未完成的elc解释器base_defs文件
1123 由steve02081504与Alex0125设计、编写
1124 转载时请在不对此文件做任何修改的同时注明出处
1125 项目地址:https://github.com/steve02081504/ELC
1126 */
1127 def_common_attribute_with_nothing(never_in_array);
1128 def_special_attribute_with_nothing(build_by_get_only);
1129
1130 //file_end
1131
1132 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1133 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/type_info.hpp"
1134 //type_info.hpp
1135 //at namespace elc::defs::base
1136 /*
1137 未完成的elc解释器base_defs文件
1138 由steve02081504与Alex0125设计、编写
1139 转载时请在不对此文件做任何修改的同时注明出处
1140 项目地址:https://github.com/steve02081504/ELC
1141 */
1142 struct type_name_t;//自动重整类型名并在析构时释放重整结果,对于gcc和clang的傻逼实现
1144 private:
1145 struct type_id_t{
1146 const ::std::type_info* _m;
1147
1148 constexpr type_id_t(const ::std::type_info&a)noexcept:_m(&a){}
1149 constexpr type_id_t(const type_id_t&a)noexcept=default;
1150 [[nodiscard]]type_name_t get_name()const noexcept;//定义于type_name.hpp
1151 [[nodiscard]]size_t get_hash()const noexcept{
1152 return _m->hash_code();
1153 }
1154 [[nodiscard]]bool operator==(const type_id_t&a)const noexcept{return *_m==*a._m;}
1155 };
1156
1157 type_id_t _tid;
1158 public:
1159 constexpr base_type_info_t(const ::std::type_info&a)noexcept:_tid(a){}
1160 constexpr base_type_info_t(const base_type_info_t&)noexcept=default;
1161 [[nodiscard]]type_name_t get_name()const noexcept;//定义于type_name.hpp
1162 [[nodiscard]]size_t get_hash()const noexcept{
1163 return _tid.get_hash();
1164 }
1165 [[nodiscard]]bool operator==(const base_type_info_t&a)const noexcept{return _tid==a._tid;}
1166 [[nodiscard]]bool operator==(const ::std::type_info&a)const noexcept{return _tid==type_id_t(a);}
1167 };
1168 template<class T>
1170 typedef T type;
1171
1172 template<class U>
1173 static constexpr bool same_as=::std::is_same_v<T,U>;
1174 template<class U>
1175 static constexpr bool not_same_as=!same_as<U>;
1176 template<class U>
1177 static constexpr bool base_on=::std::is_convertible_v<remove_cvref<T>*,remove_cvref<U>*>;
1178 template<class U>
1179 static constexpr bool not_base_on=!base_on<U>;
1180
1181 template<class U>
1182 static constexpr bool can_convert_to=::std::is_convertible_v<T,U>;
1183 template<class U>
1184 static constexpr bool can_t_convert_to=!can_convert_to<U>;
1185 template<class U>
1186 static constexpr bool can_nothrow_convert_to=::std::is_nothrow_convertible_v<T,U>;
1187 template<class U>
1188 static constexpr bool can_t_nothrow_convert_to=!can_nothrow_convert_to<U>;
1189
1190 /*
1191 //没有重载变量模板一说
1192 template<typename attribute_name>
1193 static constexpr bool has_attribute=has_attribute_helper<attribute_name>();
1194 template<typename attribute_name>
1195 static constexpr bool not_has_attribute=!has_attribute(attribute_name);
1196 */
1197 template<special_attribute_t attribute_name>
1198 static constexpr bool has_attribute_helper(){
1199 return base_on<attribute_name>;
1200 }
1201 template<common_attribute_t attribute_name>
1202 static constexpr bool has_attribute_helper(){
1203 return has_attribute_helper<attribute_name<remove_cvref<T>>>();
1204 }
1205 template<special_attribute_t attribute_name>
1206 static constexpr bool not_has_has_attribute_helper(){
1207 return!has_attribute_helper<attribute_name>();
1208 }
1209 template<common_attribute_t attribute_name>
1210 static constexpr bool not_has_has_attribute_helper(){
1211 return!has_attribute_helper<attribute_name>();
1212 }
1213
1214 // defed at defs.
1215 // #define has_attribute(...) has_attribute_helper<__VA_ARGS__>()
1216 // #define not_has_attribute(...) not_has_has_attribute_helper<__VA_ARGS__>()
1217
1218 template<common_attribute_t... common_attribute_names>
1219 struct with_common_attribute:common_attribute_pack<common_attribute_names...>::template_name on_type<T>{
1220 template<special_attribute_t... special_attribute_names>
1222 common_attribute_pack<common_attribute_names...>::template_name on_type<T>,
1223 special_attribute_pack<special_attribute_names...>::template_name on_type<T>
1224 {};
1225 };
1226 template<special_attribute_t... special_attribute_names>
1227 struct with_special_attribute:special_attribute_pack<special_attribute_names...>::template_name on_type<T>{
1228 template<common_attribute_t... common_attribute_names>
1230 special_attribute_pack<special_attribute_names...>::template_name on_type<T>,
1231 common_attribute_pack<common_attribute_names...>::template_name on_type<T>
1232 {};
1233 };
1234
1235 constexpr type_info_t()noexcept{}
1236 constexpr type_info_t(const type_info_t&)noexcept=default;
1237 [[nodiscard]]constexpr operator base_type_info_t()const noexcept{return base_type_info_t(typeid(T));}
1238 [[nodiscard]]constexpr bool operator==(const ::std::type_info&a)const noexcept{return base_type_info_t(*this)==base_type_info_t(a);}
1239 [[nodiscard]]type_name_t get_name()const noexcept;//定义于type_name.hpp
1240 [[nodiscard]]size_t get_hash()const noexcept{
1241 return base_type_info_t(*this).get_hash();
1242 }
1243 };
1244
1245 template<class T>
1246 constexpr type_info_t<T>type_info{};
1247
1248 template<class T>
1249 [[nodiscard]]constexpr bool operator==(const type_info_t<T>&,const type_info_t<T>&){return true;}
1250 template<class T,class U>
1251 [[nodiscard]]constexpr bool operator==(const type_info_t<T>&,const type_info_t<U>&){return false;}
1252
1253 /*
1254 template<class T,class U>
1255 consteval auto operator?:(auto a,const type_info_t<T>&b,const type_info_t<U>&c){
1256 if(a)
1257 return b;
1258 else
1259 if(!a)
1260 return c;
1261 else
1262 return b && c;
1263 else
1264 return void();
1265 }
1266 */
1267
1268 //file_end
1269
1270 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1271 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/min_max.hpp"
1272 //min_max.hpp
1273 //at namespace elc::defs::base
1274 /*
1275 未完成的elc解释器base_defs文件
1276 由steve02081504与Alex0125设计、编写
1277 转载时请在不对此文件做任何修改的同时注明出处
1278 项目地址:https://github.com/steve02081504/ELC
1279 */
1280 #undef min
1281 #undef max
1282 /*
1283 获取几个参数中的最小值或某类型能表示的最小值.
1284 用法:
1285 min.able<T1,T2...> -> bool T...等类型能否获得参数最小值.
1286 min.get_limit_able<T> -> bool 能否获得T类型能表示的最小值.
1287 min(v1,v2...) -> auto 获取v...的最小值.
1288 min(type_info<T>) -> auto 获取T能表示的最小值.
1289 */
1290 constexpr struct min_t{
1291 template<class...Args>
1292 static constexpr bool able=was_not_an_ill_form(::std::min(declvalue(Args)...));
1293
1294 template<typename T>
1295 static constexpr bool get_limit_able=was_not_an_ill_form(::std::numeric_limits<T>::min());
1296
1297 template<class...Args> requires able<Args...>
1298 [[nodiscard]]constexpr auto operator()(Args&&...rest)const{
1299 return ::std::min(forward<Args>(rest)...);
1300 }
1301 template<class T> requires able<::std::initializer_list<T>>
1302 [[nodiscard]]constexpr auto operator()(::std::initializer_list<T>l)const{
1303 return ::std::min(l);
1304 }
1305 template<typename T> requires get_limit_able<T>
1306 [[nodiscard]]constexpr auto operator()(type_info_t<T>)const{
1307 return ::std::numeric_limits<T>::min();
1308 }
1309 }min{};
1310 /*
1311 获取几个参数中的最大值或某类型能表示的最大值.
1312 用法:
1313 max.able<T1,T2...> -> bool T...等类型能否获得参数最大值.
1314 max.get_limit_able<T> -> bool 能否获得T类型能表示的最大值.
1315 max(v1,v2...) -> auto 获取v...的最大值.
1316 max(type_info<T>) -> auto 获取T能表示的最大值.
1317 */
1318 constexpr struct max_t{
1319 template<class...Args>
1320 static constexpr bool able=was_not_an_ill_form(::std::max(declvalue(Args)...));
1321
1322 template<typename T>
1323 static constexpr bool get_limit_able=was_not_an_ill_form(::std::numeric_limits<T>::max());
1324
1325 template<class...Args> requires able<Args...>
1326 [[nodiscard]]constexpr auto operator()(Args&&...rest)const{
1327 return ::std::max(forward<Args>(rest)...);
1328 }
1329 template<class T> requires able<::std::initializer_list<T>>
1330 [[nodiscard]]constexpr auto operator()(::std::initializer_list<T>l)const{
1331 return ::std::max(l);
1332 }
1333 template<typename T> requires get_limit_able<T>
1334 [[nodiscard]]constexpr auto operator()(type_info_t<T>)const{
1335 return ::std::numeric_limits<T>::max();
1336 }
1337 }max{};
1338
1339 //file_end
1340
1341 #line 23 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1342 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/null_ptr.hpp"
1343 //null_ptr.hpp
1344 //at namespace elc::defs::base
1345 /*
1346 未完成的elc解释器base_defs文件
1347 由steve02081504与Alex0125设计、编写
1348 转载时请在不对此文件做任何修改的同时注明出处
1349 项目地址:https://github.com/steve02081504/ELC
1350 */
1351 namespace null_ptr_n{
1352 /*
1353 提醒子类定义者重载get_null_ptr.
1354 */
1355 special_attribute_t can_t_use_default_null_ptr{};
1356
1357 /*
1358 force_use_default_null_ptr :
1359 可不重载get_null_ptr
1360 在此类ref_able或weak_ref_able时,意味着使用者**保证**所有指向此类的实例的ptr都不可为null_ptr
1361 否则将内存访问错误
1362 */
1364
1365 enable_adl(the_get_null_ptr);
1366 template<typename T>
1367 [[nodiscard]]constexpr auto get_null_ptr()noexcept{
1368 suppress_msvc_warning(26462)//貌似msvc在这里有bug
1369 constexpr auto null_as_T = static_cast<T*>(nullptr);
1370 if constexpr(was_not_an_ill_form(the_get_null_ptr(null_as_T)))
1371 return the_get_null_ptr(null_as_T);
1372 elseif constexpr(type_info<T>.has_attribute(can_t_use_default_null_ptr)&&type_info<T>.not_has_attribute(force_use_default_null_ptr)){
1373 template_error("please overload the function the_get_null_ptr in the namespace where this type is defined.");
1374 return null_as_T;
1375 }
1376 else
1377 return null_as_T;
1378 }
1379
1380
1381 /*
1382 字面量null_ptr,如同nullptr使用即可.
1383 */
1384 constexpr struct null_ptr_t{
1385 template<typename T>
1386 [[nodiscard]]constexpr_as(get_null_ptr<remove_cvref<T>>())auto base_get()const noexcept{return get_null_ptr<remove_cvref<T>>();}
1387 template<typename T>
1388 [[nodiscard]]constexpr_as(base_get<T>())operator T*()const noexcept{return down_cast<T*>(base_get<T>());}
1389 //constexpr operator decltype(nullptr)()const noexcept{return nullptr;}//提醒接口设计者注意null_ptr的重载版本.
1390 }null_ptr{};
1391
1392 template<typename T,typename U=decltype(*null_ptr.base_get<T>())>
1393 [[nodiscard]]auto operator==(T*a,null_ptr_t)noexcept{
1394 return null_ptr.base_get<T>()==static_cast<const remove_ref<U>*>(add_const(a));
1395 }
1396 }
1397 using null_ptr_n::can_t_use_default_null_ptr;
1398 using null_ptr_n::force_use_default_null_ptr;
1399 using null_ptr_n::null_ptr;
1400 typedef decltype(null_ptr) null_ptr_t;
1401 typedef decltype(nullptr) nullptr_t;
1402
1403 //file_end
1404
1405 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1406 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/compare.hpp"
1407 //compare.hpp
1408 //at namespace elc::defs::base
1409 /*
1410 未完成的elc解释器base_defs文件
1411 由steve02081504与Alex0125设计、编写
1412 转载时请在不对此文件做任何修改的同时注明出处
1413 项目地址:https://github.com/steve02081504/ELC
1414 */
1415 //end_by_zero_t
1416 /*
1417 用于标志某一数据串以0结尾
1418 */
1419 inline constexpr struct end_by_zero_t{}end_by_zero;
1420 //just_an_part_t
1421 /*
1422 用于标志某一数据串并没有完结
1423 */
1424 inline constexpr struct just_an_part_t{}just_an_part;
1425 //equal:值相等.
1426 /*
1427 相等比较任意支持比较的类型或其数组——简易封装.
1428 用法:
1429 判断两值是否可比较。
1430 equal.able<类型1,类型2(可选,默认为类型1)> -> bool
1431 判断将两者进行比较时是否会抛出异常。
1432 equal.nothrow<类型,类型2(可选,默认为类型1)> -> bool
1433
1434 equal(T1,T2) -> auto
1435
1436 equal(T1[N1],T2[N2]) -> bool
1437 equal(T1*,size1,T2*,size2) -> bool
1438 equal(T1*,T2*,size) -> bool
1439 equal(T1*,size1,T2*,end_by_zero) -> bool
1440 equal(T1*,end_by_zero,T2*,size) -> bool
1441 equal(T1*,end_by_zero,T2*,end_by_zero) -> bool
1442 */
1443 constexpr struct equal_t{
1444 template<class T,class U=T>
1445 static constexpr bool able= was_not_an_ill_form(declvalue(T)==declvalue(U));
1446 template<class T,class U=T>
1447 static constexpr bool nothrow= was_not_an_ill_form_and_noexcept(declvalue(T)==declvalue(U));
1448
1449 template<typename T,typename U>
1450 [[nodiscard]]constexpr auto operator()(T&&a,U&&b)const noexcept(nothrow<T,U>){
1451 return a==b;
1452 }
1453 template<typename T,typename U>
1454 [[nodiscard]]constexpr bool operator()(T*a,U*b,size_t size)const noexcept(nothrow<T,U>){
1455 while(size--){
1456 if(*(a++)!=*(b++))
1457 return false;
1458 }
1459 return true;
1460 }
1461 template<typename T,typename U,size_t N1,size_t N2>
1462 [[nodiscard]]constexpr bool operator()(T(&a)[N1],U(&b)[N2])const noexcept(nothrow<T,U>){
1463 if constexpr(N1==N2)
1464 return operator()(a,b,N1);
1465 else{
1466 template_warning("N1!=N2");
1467 return false;
1468 }
1469 }
1470 template<typename T,typename U>
1471 [[nodiscard]]constexpr bool operator()(T*a,size_t size1,U*b,size_t size2)const noexcept(nothrow<T,U>){
1472 if(size1==size2)
1473 return operator()(a,b,size1);
1474 else
1475 return false;
1476 }
1477 template<typename T,typename U>
1478 [[nodiscard]]constexpr bool operator()(T*a,size_t size1,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1479 while(size1--){
1480 if(*a!=*b || *b==U{0})
1481 return false;
1482 a++;
1483 b++;
1484 }
1485 return *b==U{0};
1486 }
1487 template<typename T,typename U>
1488 [[nodiscard]]constexpr bool operator()(T*a,end_by_zero_t,U*b,size_t size2)const noexcept(nothrow<T,U>){
1489 return operator()(b,size2,a,end_by_zero);
1490 }
1491 template<typename T,typename U>
1492 [[nodiscard]]constexpr bool operator()(T*a,end_by_zero_t,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1493 floop{
1494 if(*a!=*b)
1495 return false;
1496 if(*a==T{0})
1497 return true;
1498 a++;
1499 b++;
1500 }
1501 }
1502 template<typename T,typename U>
1503 [[nodiscard]]constexpr bool operator()(T*a,size_t size1,just_an_part_t,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1504 while(size1--){
1505 if(*a!=*b || *b==U{0})
1506 return false;
1507 a++;
1508 b++;
1509 }
1510 return true;
1511 }
1512 }equal{};
1513
1514 //eq:同一对象
1515 template<typename T>
1516 [[nodiscard]]constexpr auto is_eq(T&&a,T&&b)noexcept_as(&a==&b){
1517 return &a==&b;
1518 }
1519 template<typename T>
1520 [[nodiscard]]constexpr auto is_not_eq(T&&a,T&&b)noexcept_as(!is_eq(a,b)){
1521 return!is_eq(a,b);
1522 }
1523
1524 //compare:三路比较
1525 /*
1526 若大小相同则以字典序三路比较任意支持比较的类型或其数组,并在 <=> 不可用时以 < 和 == 为后备.
1527 用法:
1528 判断两者是否可真的进行三路比较。
1529 compare.r_able<类型1,类型2(可选,默认与1相同)> -> bool
1530 判断两者是否可进行compare操作。
1531 compare.able<类型1,类型2(可选,默认与1相同)> -> bool
1532 判断将两者进行三路比较是否会抛出异常。
1533 compare.nothrow<类型1,类型2(可选,默认与1相同)> -> bool
1534
1535 compare(T1,T2)
1536 compare(T1[N1],T2[N2])
1537 compare(T1*,size1,T2*,size2)
1538 compare(T1*,T2*,size)
1539 返回类型语义上是三路比较的结果类型,具体类型视情况而定.
1540
1541 以字典序进行三路比较。
1542 compare.lexicographical(T1,T2)
1543 compare.lexicographical(T1[N1],T2[N2])
1544 compare.lexicographical(T1*,size1,T2*,size2)
1545 compare.lexicographical(T1*,T2*,size)
1546 返回类型语义上是三路比较的结果类型,具体类型视情况而定.
1547
1548 翻转三路比较的结果类型。
1549 compare.reverse(order)
1550 返回对应结果类型的反义,与零相等或无法比较时则返回其本身。
1551 */
1552 constexpr struct compare_t{
1553 template<class T,class U=T>
1554 static constexpr bool r_able= was_not_an_ill_form(declvalue(T)<=>declvalue(U));
1555
1556 template<class T,class U=T>
1557 static constexpr bool able= r_able<T,U> ||
1558 was_not_an_ill_form(
1559 declvalue(T)==declvalue(U),
1560 declvalue(T)<declvalue(U),
1561 declvalue(U)<declvalue(T)
1562 );
1563 template<class T,class U=T>
1564 static constexpr bool nothrow= was_not_an_ill_form_and_noexcept(declvalue(T)<=>declvalue(U)) ||
1565 was_not_an_ill_form_and_noexcept(
1566 declvalue(T)==declvalue(U),
1567 declvalue(T)<declvalue(U),
1568 declvalue(U)<declvalue(T)
1569 );
1570
1571
1572 template<class T,class U>
1573 [[nodiscard]]static constexpr auto base_call(T&&a,U&&b)noexcept(nothrow<T,U>){
1574 //在 <=> 不可用时以 < 和 == 为后备,优于直接 <=>
1575 if constexpr(r_able<T,U>)
1576 return a<=>b;
1577 else return a == b ? partial_ordering::equivalent :
1578 a < b ? partial_ordering::less :
1579 b < a ? partial_ordering::greater :
1580 partial_ordering::unordered ;
1581 }
1582
1583 template<class T,class U=T>
1584 using type=decltype(base_call(declvalue(T),declvalue(U)));
1585
1586 template<typename T,typename U>
1587 [[nodiscard]]constexpr auto operator()(T&&a,U&&b)const noexcept(nothrow<T,U>){
1588 return base_call(a,b);
1589 }
1590 template<typename T,typename U>
1591 [[nodiscard]]constexpr auto operator()(T*a,U*b,size_t size)const noexcept(nothrow<T,U>){
1592 while(size--){
1593 if(auto tmp=base_call(*(a++),*(b++)); tmp!=0)
1594 return tmp;
1595 }
1596 return strong_ordering::equivalent;
1597 }
1598 template<typename T,typename U,size_t N1,size_t N2>
1599 [[nodiscard]]constexpr auto operator()(T(&a)[N1],U(&b)[N2])const noexcept(nothrow<T,U>){
1600 if constexpr(N1==N2)
1601 return operator()(a,b,N1);
1602 else{
1603 template_warning("N1!=N2");
1604 return N1<=>N2;
1605 }
1606 }
1607 template<typename T,typename U>
1608 [[nodiscard]]constexpr auto operator()(T*a,size_t size1,U*b,size_t size2)const noexcept(nothrow<T,U>){
1609 type<T,U> tmp=size1<=>size2;
1610 if(tmp!=0)
1611 return tmp;
1612 else
1613 return operator()(a,b,size1);
1614 }
1615 template<typename T,typename U>
1616 [[nodiscard]]constexpr auto operator()(T*a,size_t size1,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1617 type<T,U> tmp=strong_ordering::equivalent;
1618 while(size1--){
1619 if(*b==U{0})
1620 return strong_ordering::greater;
1621 if(tmp==0)
1622 tmp=base_call(*a,*b);
1623 a++;
1624 b++;
1625 }
1626 return *b==U{0}?tmp:strong_ordering::less;
1627 }
1628 template<typename T,typename U>
1629 [[nodiscard]]constexpr auto operator()(T*a,end_by_zero_t,U*b,size_t size2)const noexcept(nothrow<T,U>){
1630 type<T,U> tmp=strong_ordering::equivalent;
1631 while(size2--){
1632 if(*a==T{0})
1633 return strong_ordering::less;
1634 if(tmp==0)
1635 tmp=base_call(*a,*b);
1636 a++;
1637 b++;
1638 }
1639 return *b==U{0}?tmp:strong_ordering::less;
1640 }
1641 template<typename T,typename U>
1642 [[nodiscard]]constexpr auto operator()(T*a,end_by_zero_t,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1643 type<T,U> tmp=strong_ordering::equivalent;
1644 floop{
1645 if(*a==T{0})
1646 return *b==U{0}?tmp:strong_ordering::less;
1647 if(tmp==0)
1648 tmp=base_call(*a,*b);
1649 a++;
1650 b++;
1651 }
1652 }
1653 template<typename T,typename U>
1654 [[nodiscard]]constexpr auto operator()(T*a,size_t size1,just_an_part_t,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1655 type<T,U> tmp=strong_ordering::equivalent;
1656 while(size1--){
1657 if(*b==U{0})
1658 return strong_ordering::greater;
1659 if(tmp==0)
1660 tmp=base_call(*a,*b);
1661 a++;
1662 b++;
1663 }
1664 return tmp;
1665 }
1666 template<typename T,typename U>
1667 [[nodiscard]]constexpr auto lexicographical(T*a,size_t size1,U*b,size_t size2)const noexcept(nothrow<T,U>){
1668 if(auto tmp=operator()(a,b,min(size1,size2)); tmp!=0)
1669 return tmp;
1670 else
1671 return size1<=>size2;
1672 }
1673 template<typename T,typename U,size_t N1,size_t N2>
1674 [[nodiscard]]constexpr auto lexicographical(T(&a)[N1],U(&b)[N2])const noexcept(nothrow<T,U>){
1675 return lexicographical(a,N1,b,N2);
1676 }
1677 template<typename T,typename U>
1678 [[nodiscard]]constexpr auto lexicographical(T*a,size_t size1,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1679 while(size1--){
1680 if(*b==U{0})
1681 return strong_ordering::greater;
1682 if(auto tmp=base_call(*a,*b); tmp!=0)
1683 return tmp;
1684 a++;
1685 b++;
1686 }
1687 return *b==U{0}?strong_ordering::equivalent:
1688 strong_ordering::less;
1689 }
1690 template<typename T,typename U>
1691 [[nodiscard]]constexpr auto lexicographical(T*a,end_by_zero_t,U*b,size_t size2)const noexcept(nothrow<T,U>){
1692 while(size2--){
1693 if(*a==T{0})
1694 return strong_ordering::less;
1695 if(auto tmp=base_call(*a,*b); tmp!=0)
1696 return tmp;
1697 a++;
1698 b++;
1699 }
1700 return *b==U{0}?strong_ordering::equivalent:
1701 strong_ordering::less;
1702 }
1703 template<typename T,typename U>
1704 [[nodiscard]]constexpr auto lexicographical(T*a,end_by_zero_t,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1705 floop{
1706 if(*a==T{0})
1707 return *b==U{0}?strong_ordering::equivalent:
1708 strong_ordering::less;
1709 if(auto tmp=base_call(*a,*b); tmp!=0)
1710 return tmp;
1711 a++;
1712 b++;
1713 }
1714 }
1715 template<typename T,typename U>
1716 [[nodiscard]]constexpr auto lexicographical(T*a,size_t size1,just_an_part_t,U*b,end_by_zero_t)const noexcept(nothrow<T,U>){
1717 while(size1--){
1718 if(*b==U{0})
1719 return strong_ordering::greater;
1720 if(auto tmp=base_call(*a,*b); tmp!=0)
1721 return tmp;
1722 a++;
1723 b++;
1724 }
1725 return strong_ordering::equivalent;
1726 }
1727 //
1728 [[nodiscard]]constexpr auto reverse(partial_ordering odr)const noexcept{
1729 if(odr==partial_ordering::greater)
1730 return partial_ordering::less;
1731 elseif(odr==partial_ordering::less)
1732 return partial_ordering::greater;
1733 else
1734 return odr;
1735 }
1736 [[nodiscard]]constexpr auto reverse(weak_ordering odr)const noexcept{
1737 if(odr==weak_ordering::greater)
1738 return weak_ordering::less;
1739 elseif(odr==weak_ordering::less)
1740 return weak_ordering::greater;
1741 else
1742 return odr;
1743 }
1744 [[nodiscard]]constexpr auto reverse(strong_ordering odr)const noexcept{
1745 if(odr==strong_ordering::greater)
1746 return strong_ordering::less;
1747 elseif(odr==strong_ordering::less)
1748 return strong_ordering::greater;
1749 else
1750 return odr;
1751 }
1752 }compare{};
1753
1754 //file_end
1755
1756 #line 25 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1757 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/note.hpp"
1758 //note.hpp
1759 //at namespace elc::defs::base
1760 /*
1761 未完成的elc解释器base_defs文件
1762 由steve02081504与Alex0125设计、编写
1763 转载时请在不对此文件做任何修改的同时注明出处
1764 项目地址:https://github.com/steve02081504/ELC
1765 */
1766 namespace note_n{
1767 #define def_note(name)\
1768 template<typename T>\
1769 struct name##_t{\
1770 T value;\
1771 force_inline constexpr name##_t(T a):value(a){}\
1772 template<class U>\
1773 force_inline constexpr name##_t(name##_t<U>a):value(a.value){}\
1774 force_inline constexpr operator T(){return value;}\
1775 force_inline constexpr T operator()(){return value;}\
1776 };\
1777 template<typename T>\
1778 constexpr name##_t<T>name(T v){return{v};}
1779
1780 def_note(from);
1781 def_note(to);
1782 def_note(size);
1783
1784 #undef def_note
1785 constexpr struct fail_t{}fail{};
1786 }
1787 namespace note=note_n;
1788
1789 //file_end
1790
1791 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1792 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/array_like.hpp"
1793 //array_like.hpp
1794 //at namespace elc::defs::base
1795 /*
1796 未完成的elc解释器base_defs文件
1797 由steve02081504与Alex0125设计、编写
1798 转载时请在不对此文件做任何修改的同时注明出处
1799 项目地址:https://github.com/steve02081504/ELC
1800 */
1801 namespace array_like_n{
1802 template<class T>
1803 [[nodiscard]]inline constexpr size_t size_of_array_like(T&&)noexcept{return 1;}
1804 template<class T,size_t N>
1805 [[nodiscard]]inline constexpr size_t size_of_array_like(T(&)[N])noexcept{return N;}
1806 template<class T>
1807 [[nodiscard]]inline size_t size_of_array_like(::std::initializer_list<T>&a)noexcept{return a.size();}
1808
1809 template<class T>
1810 [[nodiscard]]inline constexpr auto begin_of_array_like(T&&a)noexcept{return addressof(a);}
1811 template<class T,size_t N>
1812 [[nodiscard]]inline constexpr auto begin_of_array_like(T(&a)[N])noexcept{return addressof(a[0]);}
1813 template<class T>
1814 [[nodiscard]]inline const T* begin_of_array_like(::std::initializer_list<T>&a)noexcept{return a.begin();}
1815
1816 template<class T>
1817 [[nodiscard]]inline auto end_of_array_like(T&&a)noexcept{return begin_of_array_like(a)+size_of_array_like(a);}
1818
1819 template<class T>
1820 constexpr bool is_array_like=was_not_an_ill_form_with_parameter(
1821 (T v){
1822 begin_of_array_like(v);
1823 size_of_array_like(v);
1824 }
1825 );
1826
1827 template<class T>
1828 constexpr bool is_signal_value_for_array_like=type_info<remove_cvref<decltype(*begin_of_array_like(declvalue(T)))>> == type_info<T>;
1829 template<class T>
1830 constexpr bool is_not_signal_value_for_array_like=!is_signal_value_for_array_like<T>;
1831
1832 template<class T,class U>
1833 constexpr bool is_array_like_for=was_not_an_ill_form_with_parameter(
1834 (U v){
1835 begin_of_array_like<T>(v);
1836 size_of_array_like<T>(v);
1837 }
1838 );
1839
1840 template<class T>
1842 typedef T* iterator;
1843 typedef const T* const_iterator;
1845 private:
1846 T*_begin=nullptr;
1847 size_t _size=0;
1848 public:
1849 constexpr explicit array_like_view_t(T*a,size_t b)noexcept:_begin(a),_size(b){}
1850 template<class U> requires is_array_like_for<T,U>
1851 explicit constexpr_as_auto array_like_view_t(U&&a)noexcept_as(begin_of_array_like<T>(a),size_of_array_like<T>(a)):array_like_view_t(begin_of_array_like<T>(a),size_of_array_like<T>(a)){}
1852 constexpr array_like_view_t(const this_t&)noexcept=default;
1853
1854 void swap_with(this_t&b)noexcept_as(swap(_begin,b._begin),swap(_size,b._size)){
1855 swap(_begin,b._begin);
1856 swap(_size,b._size);
1857 }
1858
1859 [[nodiscard]]constexpr const_iterator c_str()const noexcept{return _begin;}
1860 [[nodiscard]]constexpr size_t size()const noexcept{return _size;}
1861
1862 [[nodiscard]]constexpr iterator begin()noexcept requires(type_info<iterator>!=type_info<const_iterator>){return _begin;}
1863 [[nodiscard]]constexpr iterator end()noexcept requires(type_info<iterator>!=type_info<const_iterator>){return begin()+size();}
1864 [[nodiscard]]constexpr const_iterator begin()const noexcept{return _begin;}
1865 [[nodiscard]]constexpr const_iterator end()const noexcept{return begin()+size();}
1866
1867 [[nodiscard]]constexpr const_iterator cbegin()const noexcept{return remove_const(this)->begin();}
1868 [[nodiscard]]constexpr const_iterator cend()const noexcept{return remove_const(this)->end();}
1869
1870 [[nodiscard]]constexpr bool empty()const noexcept{return size();}
1871
1872 [[nodiscard]]constexpr T&operator[](size_t pos)noexcept{return begin()[pos];}
1873 [[nodiscard]]constexpr const T&operator[](size_t pos)const noexcept{return remove_const(*this)[pos];}
1874
1875 [[nodiscard]]constexpr auto operator<=>(this_t a)noexcept(compare.nothrow<T>){
1876 return compare(_begin,_size,a._begin,a._size);
1877 }
1878 [[nodiscard]]constexpr auto operator==(this_t a)noexcept(equal.nothrow<T>){
1879 return equal(_begin,_size,a._begin,a._size);
1880 }
1881 };
1882 template<typename T>
1885 using base_t::base_t;
1886
1887 [[nodiscard]]constexpr static size_t get_length_of(T*ptr){
1888 if(*ptr)return get_length_of(ptr+1)+1;
1889 else return 0;
1890 }
1891
1892 constexpr array_end_by_zero_t(T*ptr):base_t(ptr,get_length_of(ptr)){}
1893 };
1894
1895 template<class T>
1896 [[nodiscard]]inline constexpr T* begin_of_array_like(array_like_view_t<T>&a)noexcept requires(type_info<T>!=type_info<const T>){return a.begin();}
1897 template<class T>
1898 [[nodiscard]]inline constexpr auto begin_of_array_like(const array_like_view_t<T>&a)noexcept{return a.begin();}
1899 template<class T>
1900 [[nodiscard]]inline constexpr T* begin_of_array_like(array_like_view_t<remove_cv<T>>&a)noexcept{return a.begin();}
1901 template<class T>
1902 [[nodiscard]]inline constexpr size_t size_of_array_like(const array_like_view_t<T>&a)noexcept{return a.size();}
1903 }
1904 using array_like_n::size_of_array_like;
1905 using array_like_n::begin_of_array_like;
1906 using array_like_n::end_of_array_like;
1907 using array_like_n::is_array_like;
1908 using array_like_n::is_signal_value_for_array_like;
1909 using array_like_n::is_not_signal_value_for_array_like;
1910 using array_like_n::is_array_like_for;
1911 using array_like_n::array_like_view_t;
1912 using array_like_n::array_end_by_zero_t;
1913
1914 //file_end
1915
1916 #line 27 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1917 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/data.hpp"
1918 //data.hpp
1919 //at namespace elc::defs::base
1920 /*
1921 未完成的elc解释器base_defs文件
1922 由steve02081504与Alex0125设计、编写
1923 转载时请在不对此文件做任何修改的同时注明出处
1924 项目地址:https://github.com/steve02081504/ELC
1925 */
1926 /*
1927 每个T的可能性大小
1928 */
1929 template<class T> requires ::std::is_integral_v<T>
1930 constexpr size_t number_of_possible_values_per=max(type_info<::std::make_unsigned_t<T>>)+size_t{1};
1931 /*
1932 每个T有多少位
1933 */
1934 template<class T>
1935 constexpr size_t bitnumof=sizeof(T)*CHAR_BIT;
1936
1937 /*
1938 功能: byte* 类型数据转换为 T&,不进行任何检查
1939 用法: data_cast<T>(byte*) -> T&
1940 */
1941 template<class T>
1942 [[nodiscard]]constexpr T&data_cast(byte*p){return*::std::launder(reinterpret_cast<T*>(p));}
1943 /*
1944 功能: T* 指针转换为 byte*,不进行任何检查
1945 用法: cast_to_data(T*) -> byte*
1946 */
1947 template<class T>
1948 [[nodiscard]]constexpr byte*cast_to_data(T*p){return ::std::launder(reinterpret_cast<byte*>(p));}
1949 /*
1950 功能: const T* 指针转换为 const byte*,不进行任何检查
1951 用法: cast_to_data(const T*) -> const byte*
1952 */
1953 template<class T>
1954 [[nodiscard]]constexpr const byte*cast_to_data(const T*p){return ::std::launder(reinterpret_cast<const byte*>(p));}
1955
1956 /*
1957 功能: data_block类模板,接受多个类型参数,实例化为内含最大体积最大对齐要求的byte数组的结构体
1958 data_block -> byte*
1959 用法: data_block<T1,T2,...>value;
1960 */
1961 template<class...Ts>
1963 push_and_disable_msvc_warning(4324);
1964 alignas(max({alignof(Ts)...}))
1965 byte _data[max({sizeof(Ts)...})];
1966 constexpr operator byte*(){return _data;}
1967 pop_msvc_warning();
1968 };
1969
1970 /*
1971 功能: data_view类模板,接受一个类型参数,提供对byte数组的访问和遍历
1972 用法: data_view<T>value{&value};
1973 */
1974 template<class T>
1976 using array_like_view_t<byte>::array_like_view_t;
1977 constexpr data_view(T*p):array_like_view_t<byte>{cast_to_data(p),sizeof(T)}{}
1978 };
1979 template<class T>
1980 struct data_view<const T>:array_like_view_t<const byte>{
1981 using array_like_view_t<const byte>::array_like_view_t;
1982 constexpr data_view(const T*p):array_like_view_t<const byte>{cast_to_data(p),sizeof(T)}{}
1983 };
1984
1985 /*
1986 功能: 比较两个类实例在内存中的内容是否相同
1987 用法: full_equal_in_byte(const T&a,const T&b) -> bool
1988 */
1989 template<class T>
1990 [[nodiscard]]constexpr bool full_equal_in_byte(const T&a,const T&b){
1991 return equal(cast_to_data(&a),cast_to_data(&b),sizeof(T));
1992 }
1993
1994 //file_end
1995
1996 #line 28 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
1997 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/pointer.hpp"
1998 //pointer.hpp
1999 //at namespace elc::defs::base
2000 /*
2001 未完成的elc解释器base_defs文件
2002 由steve02081504与Alex0125设计、编写
2003 转载时请在不对此文件做任何修改的同时注明出处
2004 项目地址:https://github.com/steve02081504/ELC
2005 */
2006
2007 enable_adl(the_pointer_to_bool);
2008 //指针转bool的重载接口,允许类对此进行自定义
2009 //elc内部的指针转bool应当视情况使用默认配置或此重载接口
2010 template<typename T>
2011 [[nodiscard]]constexpr auto pointer_to_bool(T*a)noexcept{
2012 if constexpr(was_not_an_ill_form(the_pointer_to_bool(a)))
2013 return the_pointer_to_bool(a);
2014 else
2015 return null_ptr!=a;
2016 }
2017
2018 enable_adl(the_pointer_equal);
2019 //指针比较的重载接口,允许类对此进行自定义
2020 //elc内部的指针比较应当视情况使用默认配置或此重载接口
2021 template<typename T>
2022 [[nodiscard]]constexpr auto pointer_equal(T*a,T*b)noexcept{
2023 if constexpr(was_not_an_ill_form(the_pointer_equal(a,b)))
2024 return the_pointer_equal(a,b);
2025 else
2026 return a==b;
2027 }
2028
2029 //判断类型是否为指针
2030 template<class T>
2031 inline constexpr bool is_pointer= ::std::is_pointer_v<T>;
2032 //未知类型指针
2033 typedef void*pointer;
2034 //未知类型指针,不可写
2035 typedef const void*const_pointer;
2036
2037 //获取两个指针的偏移
2038 [[nodiscard]]constexpr ptrdiff_t get_off_set(note::from_t<const_pointer>a,note::to_t<const_pointer>b)noexcept{
2039 return cast_to_data(b())-cast_to_data(a());//b-a == c
2040 }
2041 //应用偏移
2042 template<class T>
2043 [[nodiscard]]constexpr auto apply_off_set(T*a,ptrdiff_t c)noexcept{
2044 return cast_to_data(a)+c;//a+c == b
2045 }
2046 //反向应用偏移
2047 template<class T>
2048 [[nodiscard]]constexpr auto unapply_off_set(T*b,ptrdiff_t c)noexcept{
2049 return cast_to_data(b)-c;//b-c == a
2050 }
2051
2052 //file_end
2053
2054 #line 29 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
2055 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/hash.hpp"
2056 //hash.hpp
2057 //at namespace elc::defs::base
2058 /*
2059 未完成的elc解释器base_defs文件
2060 由steve02081504与Alex0125设计、编写
2061 转载时请在不对此文件做任何修改的同时注明出处
2062 项目地址:https://github.com/steve02081504/ELC
2063 */
2064 namespace hash_n{
2065 typedef size_t hash_base_t;
2067 hash_base_t _value;
2068 constexpr hash_base_t operator%(auto&&a)const noexcept{
2069 return _value%a;
2070 }
2071 constexpr bool operator==(const hash_value_t&a)const noexcept{
2072 return _value==a._value;
2073 }
2074 };
2076 unstable_hash_value_t(const hash_value_t&a)noexcept:hash_value_t(a){}
2077 };
2078
2079 template<class T>
2080 inline constexpr bool is_unstable_hash = type_info<T const>.can_convert_to<unstable_hash_value_t>;
2081 template<class T>
2082 inline constexpr bool is_fundamental_hash = ::std::is_fundamental_v<T>;
2083
2084 enable_adl(the_pointer_hash);
2085 template<class T>
2086 [[nodiscard]]inline constexpr hash_value_t pointer_hash(T*a)noexcept{
2087 if constexpr(was_not_an_ill_form(the_pointer_hash(a)))
2088 return the_pointer_hash(a);
2089 else
2090 return{hash_base_t(a)};
2091 }
2092
2093 inline struct hash_t{
2094 template<class T>
2095 [[nodiscard]]static constexpr inline bool nothrow_helper()noexcept{
2096 if constexpr(is_pointer<T>)
2097 return noexcept(pointer_hash(declvalue(const T&)));
2098 elseif constexpr(is_fundamental_hash<T>)
2099 return noexcept(hash_value_t{hash_base_t(declvalue(const T&))});
2100 elseif constexpr(is_unstable_hash<T>)
2101 return noexcept(unstable_hash_value_t(declvalue(const T&)));
2102 elseif constexpr(was_not_an_ill_form(declvalue(const T&).hash()))
2103 return noexcept(declvalue(const T&).hash());
2104 elseif constexpr(was_not_an_ill_form(hash_value_t(declvalue(const T&))))
2105 return noexcept(hash_value_t(declvalue(const T&)));
2106 elseif constexpr(type_info<remove_cv<T>> == type_info<base_type_info_t>)
2107 return true;
2108 else
2109 return false;
2110 }
2111 template<class T>
2112 static constexpr bool nothrow=nothrow_helper<T>();
2113 template<class T>
2114 [[nodiscard]]static constexpr inline bool able_helper()noexcept{
2115 if constexpr(is_pointer<T>)
2116 return true;
2117 elseif constexpr(is_fundamental_hash<T>)
2118 return true;
2119 elseif constexpr(is_unstable_hash<T>)
2120 return true;
2121 elseif constexpr(was_not_an_ill_form(declvalue(const T&).hash()))
2122 return true;
2123 elseif constexpr(was_not_an_ill_form(hash_value_t(declvalue(const T&))))
2124 return true;
2125 elseif constexpr(type_info<remove_cv<T>> == type_info<base_type_info_t>)
2126 return true;
2127 else
2128 return false;
2129 }
2130 template<class T>
2131 static constexpr bool able=able_helper<T>();
2132
2133 #define hash operator()
2134
2135 [[nodiscard]]inline constexpr hash_value_t hash(nothing)const noexcept{
2136 return{hash_base_t(nothing)};
2137 }
2138 [[nodiscard]]inline hash_value_t hash(const base_type_info_t&a)const noexcept{
2139 return{a.get_hash()};
2140 }
2141 template<class T> requires able<T>
2142 [[nodiscard]]constexpr_as_auto inline auto hash(const T&a)const noexcept(nothrow<T>){
2143 #undef hash
2144 if constexpr(is_pointer<T>)
2145 return pointer_hash(a);
2146 elseif constexpr(is_fundamental_hash<T>)
2147 return hash_value_t{hash_base_t(a)};
2148 elseif constexpr(is_unstable_hash<T>)
2149 return unstable_hash_value_t(a);
2150 elseif constexpr(was_not_an_ill_form(declvalue(const T&).hash()))
2151 return a.hash();
2152 elseif constexpr(was_not_an_ill_form(hash_value_t(declvalue(const T&))))
2153 return hash_value_t(a);
2154 else{
2155 template_error("Please overload the function hash in the namespace where this type is defined.");
2156 return hash_value_t{};
2157 }
2158 #define hash operator()
2159 }
2160 template<class T>
2161 [[nodiscard]]constexpr_as_auto inline hash_base_t get_hash_in_base_type(const T&a)const noexcept(nothrow<T>){
2162 return hash(a)._value;
2163 }
2164
2165 /*从某个起始点算起的hash*/
2166 template<class T>
2167 [[nodiscard]]force_inline constexpr hash_value_t with_calculated_before(hash_value_t before,size_t before_size,const T*a,size_t size)const noexcept{
2168 hash_base_t aret=before._value;
2169 rot_iterator<decltype(aret)>rotl_offset = before_size+size;
2170 while(size--){
2171 aret ^= rotl(get_hash_in_base_type(a[size]),rotl_offset);
2172 rotl_offset--;
2173 }
2174 return{aret};
2175 }
2176 /*计算此hash重复N次的数组的hash结果*/
2177 [[nodiscard]]force_inline constexpr hash_value_t repeat_times(hash_value_t value,size_t size)const noexcept{
2178 hash_base_t aret=0;
2179 {
2180 //优化.
2181 //关於此,咱确信咱发现一种美妙的证法来保证这个优化不影响结果,但可惜凋可怜的脑容量不足以让他看懂.
2182 constexpr size_t bit_range_max=bitnum_of(hash_base_t);
2183 constexpr hash_base_t void_hash{nothing};
2184 suppress_msvc_warning(26475)//强制转换警告diss.
2185 constexpr hash_base_t npos_hash{hash_base_t(-1)};
2186 constexpr size_t bitnumof_void=bit_range_max*BIT_POSSIBILITY;
2187
2188 size=size%bitnumof_void;
2189 if(value._value==0 || size==0)
2190 return {void_hash};
2191 if(size >= bit_range_max){
2192 const bool is_npos = ::std::popcount(value._value)%BIT_POSSIBILITY;
2193 aret = is_npos?npos_hash:void_hash;
2194 size-=bit_range_max;
2195 }
2196 if(!size)
2197 return {aret};
2198 }
2199 rot_iterator<decltype(aret)>rotl_offset = size;
2200 while(size--){
2201 aret ^= rotl(value._value,rotl_offset);
2202 rotl_offset--;
2203 }
2204 return{aret};
2205 }
2206 /*计算此hash重复N次的数组的hash结果*/
2207 template<class T>
2208 [[nodiscard]]force_inline constexpr hash_value_t repeat_times(T&&value,size_t size)const noexcept{
2209 return repeat_times(hash(value),size);
2210 }
2211 template<class T>
2212 [[nodiscard]]constexpr inline hash_value_t hash(const T*a,size_t size)const noexcept(nothrow<const T>){
2213 return with_calculated_before(hash(nothing),0,a,size);
2214 }
2215 /*合并两个数据段的hash结果,好似计算这两个数据段合并后的hash结果一般*/
2216 [[nodiscard]]force_inline hash_value_t merge_array_hash_results(
2217 hash_value_t before,size_t before_size,hash_value_t after,[[maybe_unused]]size_t after_size
2218 )const noexcept{
2219 return{before._value^(rotl(after._value,before_size))};
2220 }
2221 template<class T> requires is_not_signal_value_for_array_like<T>
2222 [[nodiscard]]constexpr inline hash_value_t hash(const array_like_view_t<T>a)const noexcept(nothrow<T>){
2223 return hash(a.begin(),a.size());
2224 }
2225 template<class T> requires is_not_signal_value_for_array_like<T>
2226 [[nodiscard]]constexpr inline hash_value_t with_calculated_before(hash_value_t before,size_t before_size,const array_like_view_t<T>a)const noexcept{
2227 return with_calculated_before(before,before_size,a.begin(),a.size());
2228 }
2229
2230 #undef hash
2231
2232 }hash{};
2233 }
2236 using hash_n::is_unstable_hash;
2237 using hash_n::is_fundamental_hash;
2238 using hash_n::hash;
2239
2240 //file_end
2241
2242 #line 30 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
2243 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/range.hpp"
2244 //range.hpp
2245 //at namespace elc::defs::base
2246 /*
2247 未完成的elc解释器base_defs文件
2248 由steve02081504与Alex0125设计、编写
2249 转载时请在不对此文件做任何修改的同时注明出处
2250 项目地址:https://github.com/steve02081504/ELC
2251 */
2252 namespace range_n{
2253 //range_t
2254 //用以表示某类型的数值范围,仅可表示闭区间
2255 template<typename T>
2256 struct range_t{
2257 T _begin,_end;
2258 //_begin<=_end
2259 constexpr range_t(const T begin,const T end):_begin(begin),_end(end){}
2260 constexpr range_t(note::from_t<const T>begin,note::to_t<const T>end):_begin(begin),_end(end+1){}
2261 constexpr range_t(note::to_t<const T>end,note::from_t<const T>begin):_begin(begin),_end(end+1){}
2262 constexpr range_t(const T begin,note::size_t<const T>size):_begin(begin),_end(begin+size()){}
2263 constexpr range_t(const T begin,note::size_t<size_t>size):_begin(begin),_end(begin+size()){}
2264
2265 constexpr size_t size()noexcept{return _end-_begin;}
2266 constexpr auto end()noexcept{return _end;}
2267 constexpr auto begin()noexcept{return _begin;}
2268 constexpr auto end()const noexcept{return _end;}
2269 constexpr auto begin()const noexcept{return _begin;}
2270
2271 template <class U> requires(type_info<T>.can_convert_to<U>)
2272 constexpr operator range_t<U>()const noexcept(type_info<T>.can_nothrow_convert_to<U>){
2273 return {_begin,_end};
2274 }
2275 };
2276
2277 template<class T>
2278 [[nodiscard]]inline auto size_of_array_like(range_t<T*>&a)noexcept{return a.size();}
2279 template<class T>
2280 [[nodiscard]]inline auto size_of_array_like(range_t<const T*>&a)noexcept{return a.size();}
2281
2282 template<class T>
2283 [[nodiscard]]inline auto begin_of_array_like(range_t<T*>&a)noexcept{return a.begin();}
2284 template<class T>
2285 [[nodiscard]]inline auto begin_of_array_like(range_t<const T*>&a)noexcept{return a.begin();}
2286
2287 //in_range
2288 //判断一个值是否在某个范围内
2289 template<typename T>
2290 [[nodiscard]]constexpr bool in_range(T pattern,const range_t<T>range)noexcept_as(bool(declvalue(T)>=declvalue(const T) && declvalue(T)<=declvalue(const T))){//算术类型或指针
2291 return bool(pattern>=range.begin() && pattern<range.end());
2292 }
2293 //in_range
2294 //判断一个指针是否在某个byte指针范围内
2295 template<typename T>
2296 [[nodiscard]]constexpr bool in_range(T*pattern,const range_t<byte*>range)noexcept{
2297 return cast_to_data(pattern)>=range.begin() && cast_to_data(pattern)<range.end();
2298 }
2299 //match_pattern
2300 //BMH2改算法表头,用以实施头起始的快速子串匹配算法
2301 //大部分情况下应当编译时预构建或对运行时生成的实例进行缓存
2302 template<typename T>
2304 array_like_view_t<T>_pattern;
2305 typedef unsigned char index_type;
2306
2307 size_t skip_table[number_of_possible_values_per<index_type>]{};
2308 size_t radical_skip_table[number_of_possible_values_per<index_type>]{};
2309 index_type pre_index_table[number_of_possible_values_per<index_type>]{};
2310
2311 static constexpr index_type get_index_of(T&ch)noexcept{
2312 return index_type(hash(ch) % number_of_possible_values_per<index_type>);
2313 }
2314 constexpr void build_table(array_like_view_t<T>pattern)noexcept{
2315 const size_t m=pattern.size();
2316 if(!m)
2317 return;
2318 for(size_t i=0;i<number_of_possible_values_per<index_type>;i++){
2319 skip_table[i]=radical_skip_table[i]=m;
2320 }
2321 skip_table[get_index_of(pattern[0])]=radical_skip_table[get_index_of(pattern[0])]=m-1;//单独处理pattern[0]的情况
2322 for(size_t i=1;i<m-1;i++){
2323 index_type index=get_index_of(pattern[i]);//radical_skip_table[index]表示pattern中倒数第二次出现的index到pattern末尾的距离
2324 radical_skip_table[index]=skip_table[index];//当index在pattern中出现0次或1次时,radical_skip_table[index]等于模式串长度m
2325 skip_table[index]=m-i-1;//skip数组的定义与BMH算法相同
2326 pre_index_table[index]=get_index_of(pattern[i-1]);
2327 }
2328 }
2329 constexpr match_pattern(array_like_view_t<T>pattern)noexcept:_pattern(pattern){
2330 build_table(_pattern);
2331 }
2332 [[nodiscard]]constexpr T* match(array_like_view_t<T>range)const noexcept{
2333 size_t m = _pattern.size();
2334 if(!m)
2335 return range.begin();
2336 size_t n= range.size();
2337 size_t i= m-1;
2338 while(i<n){
2339 size_t k=i;
2340 ptrdiff_t j=m-1;//k记录text中每次从右至左开始比较的起始位置
2341 while((j>=0)&&(_pattern[j]==range[i])){
2342 i--;j--;
2343 }
2344 if(j==-1)
2345 return addressof(range[i+1]);//在range[i+1]处匹配成功
2346 index_type index_k=get_index_of(range[k]);
2347 if(get_index_of(range[k-1])!=pre_index_table[index_k])
2348 i=k+radical_skip_table[index_k];//采用激进策略移动文本指针
2349 else
2350 i=k+skip_table[index_k];
2351 }
2352 return nullptr;//匹配失败
2353 }
2354 };
2355 //reverse_match_pattern
2356 //反向BMH2改算法表头,用以实施尾起始的快速子串匹配算法
2357 //大部分情况下应当编译时预构建或对运行时生成的实例进行缓存
2358 template<typename T>
2360 array_like_view_t<T>_pattern;
2361 typedef unsigned char index_type;
2362
2363 size_t skip_table[number_of_possible_values_per<index_type>]{};
2364 size_t radical_skip_table[number_of_possible_values_per<index_type>]{};
2365 index_type pre_index_table[number_of_possible_values_per<index_type>]{};
2366
2367 static constexpr index_type get_index_of(T&ch)noexcept{
2368 return index_type(hash(ch) % number_of_possible_values_per<index_type>);
2369 }
2370 constexpr void build_table(array_like_view_t<T>pattern)noexcept{
2371 const size_t m=pattern.size();
2372 if(!m)
2373 return;
2374 for(size_t i=0;i<number_of_possible_values_per<index_type>;i++){
2375 skip_table[i]=radical_skip_table[i]=m;
2376 }
2377 skip_table[get_index_of(pattern[m-1])]=radical_skip_table[get_index_of(pattern[m-1])]=m-1;//单独处理pattern[m-1]的情况
2378 for(ptrdiff_t i=m-2;i>=0;i--){
2379 index_type index=get_index_of(pattern[i]);//radical_skip_table[index]表示pattern中倒数第二次出现的index到pattern末尾的距离
2380 radical_skip_table[index]=skip_table[index];//当index在pattern中出现0次或1次时,radical_skip_table[index]等于模式串长度m
2381 skip_table[index]=i;//skip数组的定义与BMH算法相同
2382 pre_index_table[index]=get_index_of(pattern[i+1]);
2383 }
2384 }
2385 constexpr reverse_match_pattern(array_like_view_t<T>pattern)noexcept:_pattern(pattern){
2386 build_table(_pattern);
2387 }
2388 [[nodiscard]]constexpr T* match(array_like_view_t<T>range)const noexcept{
2389 size_t m=_pattern.size();
2390 if(!m)
2391 return range.begin();
2392 size_t n= range.size();
2393 ptrdiff_t i= n-m;
2394 while(i>=0){
2395 size_t k=i;
2396 size_t j=0;//k记录text中每次从右至左开始比较的起始位置
2397 while((j<=m-1)&&(_pattern[j]==range[i])){
2398 i++;j++;
2399 }
2400 if(j==m)
2401 return addressof(range[k]);//在range[k]处匹配成功
2402 index_type index_k=get_index_of(range[k]);
2403 if(get_index_of(range[k+1])!=pre_index_table[index_k])
2404 i=k-radical_skip_table[index_k];//采用激进策略移动文本指针
2405 else
2406 i=k-skip_table[index_k];
2407 }
2408 return nullptr;//匹配失败
2409 }
2410 };
2411 suppress_msvc_warning(26475)//强制转换警告diss
2412 //npos
2413 //用以指定不存在的位置
2414 static constexpr size_t npos = size_t(-1);
2415 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
2416 template<typename T>
2417 [[nodiscard]]constexpr T* in_range(T&pattern,array_like_view_t<T>range){
2418 for(auto&i : range){
2419 if(i==pattern)
2420 return addressof(i);
2421 }
2422 return nullptr;
2423 }
2424 //若成功找到匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2425 template<typename T>
2426 [[nodiscard]]constexpr size_t in_range_size_t(T&pattern,array_like_view_t<T>range){
2427 auto result = in_range(pattern,range);
2428 if(result)
2429 return result - range.begin();
2430 else
2431 return npos;
2432 }
2433 //数据串匹配by steve02081504.
2434 //若成功找到匹配的数据串,返回其开头,若未找到,返回nullptr
2435 template<typename T>
2436 [[nodiscard]]constexpr T* in_range(array_like_view_t<T>pattern,array_like_view_t<T>range){
2437 if(range.size() >= 512 && pattern.size() >= 11){
2438 match_pattern tmp=pattern;
2439 return tmp.match(range);
2440 }
2441
2442 size_t off_set=0;
2443 size_t matching_off_set=1;
2444
2445 floop{
2446 matching_off_set=1;
2447 while(pattern.end()[0-matching_off_set]==range.begin()[off_set+pattern.size()-matching_off_set])
2448 if(matching_off_set==pattern.size())
2449 return addressof(range.begin()[off_set]);
2450 else
2451 matching_off_set++;
2452 if(off_set+pattern.size() >= range.size())
2453 return nullptr;
2454 auto tmp = in_range(range.begin()[off_set+pattern.size()], pattern);
2455 if(!tmp)
2456 tmp=pattern.begin();
2457 off_set+=pattern.end()-tmp;
2458 }
2459 }
2460 //若成功找到匹配的数据串,返回其距离开头的步数,若未找到,返回npos
2461 template<typename T>
2462 [[nodiscard]]constexpr size_t in_range_size_t(array_like_view_t<T>pattern,array_like_view_t<T>range){
2463 auto result = in_range(pattern,range);
2464 if(result)
2465 return result - range.begin();
2466 else
2467 return npos;
2468 }
2469 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
2470 template<typename T>
2471 [[nodiscard]]constexpr T* in_range_but_reverse(T&pattern,array_like_view_t<T>range){
2472 for(auto&i : range|::std::views::reverse){
2473 if(i==pattern)
2474 return addressof(i);
2475 }
2476 return nullptr;
2477 }
2478 //若成功找到匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2479 template<typename T>
2480 [[nodiscard]]constexpr size_t in_range_but_reverse_size_t(T&pattern,array_like_view_t<T>range){
2481 auto result = in_range_but_reverse(pattern,range);
2482 if(result)
2483 return result - range.begin();
2484 else
2485 return npos;
2486 }
2487 //反向数据串匹配by steve02081504.
2488 //若成功找到匹配的数据串,返回其开头,若未找到,返回nullptr
2489 template<typename T>
2490 [[nodiscard]]constexpr T* in_range_but_reverse(array_like_view_t<T>pattern,array_like_view_t<T>range){
2491 if(range.size() >= 512 && pattern.size() >= 11){
2492 reverse_match_pattern tmp = pattern;
2493 return tmp.match(range);
2494 }
2495
2496 size_t off_set=0;
2497 size_t matching_off_set=0;
2498
2499 floop{
2500 matching_off_set=0;
2501 while(pattern.begin()[matching_off_set]==range.end()[0-(off_set+pattern.size()-matching_off_set)])
2502 if(matching_off_set==pattern.size()-1)
2503 return addressof(range.end()[0-(off_set+pattern.size())]);
2504 else
2505 matching_off_set++;
2506 if(off_set+pattern.size() >= range.size())
2507 return nullptr;
2508 auto tmp = in_range_but_reverse(range.end()[0-(off_set+pattern.size()+1)], pattern);
2509 if(!tmp)
2510 tmp=pattern.end()-1;
2511 off_set+=tmp-pattern.begin();
2512 off_set+=1;
2513 }
2514 }
2515 //若成功找到匹配的数据串,返回其距离开头的步数,若未找到,返回npos
2516 template<typename T>
2517 [[nodiscard]]constexpr size_t in_range_but_reverse_size_t(array_like_view_t<T>pattern,array_like_view_t<T>range){
2518 auto result = in_range_but_reverse(pattern,range);
2519 if(result)
2520 return result - range.begin();
2521 else
2522 return npos;
2523 }
2524
2525 //bitmark_for_finds
2526 //bitmark提供了一种快速进行四种泛搜索的实现,前提是构建中的pattern中的每一项的usigned表示都在一个字节(表长)内。
2527 //若bitmark构建失败,程序应当使用正在进行的泛搜索的朴素实现版本。
2528 template<typename T>
2530 typedef unsigned char index_type;
2531 bool _bitmark[number_of_possible_values_per<index_type>]{};
2532
2533 bitmark_for_finds()noexcept=default;
2534 [[nodiscard]]constexpr bool mark(array_like_view_t<T>pattern)noexcept{
2535 if constexpr(number_of_possible_values_per<T> > number_of_possible_values_per<index_type>){
2536 for(auto& i: pattern){
2537 if(::std::make_unsigned_t<T>(i) >= number_of_possible_values_per<index_type>)
2538 return false;
2539 _bitmark[index_type(i)] = true;
2540 }
2541 }
2542 else{
2543 for(auto& i: pattern)
2544 _bitmark[index_type(i)] = true;
2545 }
2546 return true;
2547 }
2548 [[nodiscard]]constexpr bool operator[](T&index)const noexcept{
2549 if constexpr(number_of_possible_values_per<T> > number_of_possible_values_per<index_type>)
2550 if(::std::make_unsigned_t<T>(index) >= number_of_possible_values_per<index_type>)
2551 return false;
2552 return _bitmark[index_type(index)];
2553 }
2554 };
2555 //find_first_of的bitmark实现
2556 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
2557 template<typename T>
2558 [[nodiscard]]constexpr T* find_first_of_bitmark(const bitmark_for_finds<T>&mark,array_like_view_t<T>range){
2559 for(auto&i : range){
2560 if(mark[i])
2561 return addressof(i);
2562 }
2563 return nullptr;
2564 }
2565 //find_first_of的朴素实现
2566 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
2567 template<typename T>
2568 [[nodiscard]]constexpr T* base_find_first_of(array_like_view_t<T>pattern,array_like_view_t<T>range){
2569 for(auto&i : range){
2570 if(in_range(i,pattern))
2571 return addressof(i);
2572 }
2573 return nullptr;
2574 }
2575 //find_first_of
2576 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
2577 template<typename T>
2578 [[nodiscard]]constexpr T* find_first_of(array_like_view_t<T>pattern,array_like_view_t<T>range){
2579 if constexpr(::std::is_integral_v<T>){
2580 bitmark_for_finds<T> mark;
2581 if(mark.mark(pattern))
2582 return find_first_of_bitmark(mark,range);
2583 }
2584 return base_find_first_of(pattern,range);
2585 }
2586 //若成功找到匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2587 template<typename T>
2588 [[nodiscard]]constexpr size_t find_first_of_size_t(array_like_view_t<T>pattern,array_like_view_t<T>range){
2589 auto result = find_first_of(pattern,range);
2590 if(result)
2591 return result - range.begin();
2592 else
2593 return npos;
2594 }
2595 //find_last_of的bitmark实现
2596 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
2597 template<typename T>
2598 [[nodiscard]]constexpr T* find_last_of_bitmark(const bitmark_for_finds<T>&mark,array_like_view_t<T>range){
2599 for(auto& i: range|::std::views::reverse){
2600 if(mark[i])
2601 return addressof(i);
2602 }
2603 }
2604 //find_last_of的朴素实现
2605 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
2606 template<typename T>
2607 [[nodiscard]]constexpr T* base_find_last_of(array_like_view_t<T>pattern,array_like_view_t<T>range){
2608 for(auto&i : range|::std::views::reverse){
2609 if(in_range(i,pattern))
2610 return addressof(i);
2611 }
2612 return nullptr;
2613 }
2614 //find_last_of
2615 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
2616 template<typename T>
2617 [[nodiscard]]constexpr T* find_last_of(array_like_view_t<T>pattern,array_like_view_t<T>range){
2618 if constexpr(::std::is_integral_v<T>){
2619 bitmark_for_finds<T> mark;
2620 if(mark.mark(pattern))
2621 return find_last_of_bitmark(mark,range);
2622 }
2623 return base_find_last_of(pattern,range);
2624 }
2625 //若成功找到匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2626 template<typename T>
2627 [[nodiscard]]constexpr size_t find_last_of_size_t(array_like_view_t<T>pattern,array_like_view_t<T>range){
2628 auto result = find_last_of(pattern,range);
2629 if(result)
2630 return result - range.begin();
2631 else
2632 return npos;
2633 }
2634 //find_first_not_of的bitmark实现
2635 //若成功找到不匹配的数据项,返回其开头,若未找到,返回nullptr
2636 template<typename T>
2637 [[nodiscard]]constexpr T* find_first_not_of_bitmark(const bitmark_for_finds<T>&mark,array_like_view_t<T>range){
2638 for(auto& i: range){
2639 if(!mark[i])
2640 return addressof(i);
2641 }
2642 return nullptr;
2643 }
2644 //find_first_not_of的朴素实现
2645 //若成功找到不匹配的数据项,返回其开头,若未找到,返回nullptr
2646 template<typename T>
2647 [[nodiscard]]constexpr T* base_find_first_not_of(array_like_view_t<T>pattern,array_like_view_t<T>range){
2648 for(auto&i : range){
2649 if(!in_range(i,pattern))
2650 return addressof(i);
2651 }
2652 return nullptr;
2653 }
2654 //find_first_not_of
2655 //若成功找到不匹配的数据项,返回其开头,若未找到,返回nullptr
2656 template<typename T>
2657 [[nodiscard]]constexpr T* find_first_not_of(array_like_view_t<T>pattern,array_like_view_t<T>range){
2658 if constexpr(::std::is_integral_v<T>){
2659 bitmark_for_finds<T> mark;
2660 if(mark.mark(pattern))
2661 return find_first_not_of_bitmark(mark,range);
2662 }
2663 return base_find_first_not_of(pattern,range);
2664 }
2665 //若成功找到不匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2666 template<typename T>
2667 [[nodiscard]]constexpr size_t find_first_not_of_size_t(array_like_view_t<T>pattern,array_like_view_t<T>range){
2668 auto result = find_first_not_of(pattern,range);
2669 if(result)
2670 return result - range.begin();
2671 else
2672 return npos;
2673 }
2674 //find_last_not_of的bitmark实现
2675 //若成功找到不匹配的数据项,返回其开头,若未找到,返回nullptr
2676 template<typename T>
2677 [[nodiscard]]constexpr T* find_last_not_of_bitmark(const bitmark_for_finds<T>&mark,array_like_view_t<T>range){
2678 for(auto& i: range|::std::views::reverse){
2679 if(!mark[i])
2680 return addressof(i);
2681 }
2682 return nullptr;
2683 }
2684 //find_last_not_of的朴素实现
2685 //若成功找到不匹配的数据项,返回其开头,若未找到,返回nullptr
2686 template<typename T>
2687 [[nodiscard]]constexpr T* base_find_last_not_of(array_like_view_t<T>pattern,array_like_view_t<T>range){
2688 for(auto&i : range|::std::views::reverse){
2689 if(!in_range(i,pattern))
2690 return addressof(i);
2691 }
2692 return nullptr;
2693 }
2694 //find_last_not_of
2695 //若成功找到不匹配的数据项,返回其开头,若未找到,返回nullptr
2696 template<typename T>
2697 [[nodiscard]]constexpr T* find_last_not_of(array_like_view_t<T>pattern,array_like_view_t<T>range){
2698 if constexpr(::std::is_integral_v<T>){
2699 bitmark_for_finds<T> mark;
2700 if(mark.mark(pattern))
2701 return find_last_not_of_bitmark(mark,range);
2702 }
2703 return base_find_last_not_of(pattern,range);
2704 }
2705 //若成功找到不匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2706 template<typename T>
2707 [[nodiscard]]constexpr size_t find_last_not_of_size_t(array_like_view_t<T>pattern,array_like_view_t<T>range){
2708 auto result = find_last_not_of(pattern,range);
2709 if(result)
2710 return result - range.begin();
2711 else
2712 return npos;
2713 }
2714 }
2715 using range_n::range_t;
2716 using range_n::in_range;
2717 using range_n::in_range_size_t;
2718 using range_n::in_range_but_reverse;
2719 using range_n::in_range_but_reverse_size_t;
2720 using range_n::find_first_of;
2721 using range_n::find_last_of;
2722 using range_n::find_first_not_of;
2723 using range_n::find_last_not_of;
2724
2725 //file_end
2726
2727 #line 31 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
2728 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/string_view.hpp"
2729 //string_view.hpp
2730 //at namespace elc::defs::base
2731 /*
2732 未完成的elc解释器base_defs文件
2733 由steve02081504与Alex0125设计、编写
2734 转载时请在不对此文件做任何修改的同时注明出处
2735 项目地址:https://github.com/steve02081504/ELC
2736 */
2737 //仅是声明
2738 namespace constexpr_str_n {
2739 template<typename char_T>
2740 struct constexpr_str_t;
2741 }
2742 using constexpr_str_n::constexpr_str_t;
2743 //重载range操作
2744 //仅是声明以及size_t包装
2745 namespace range_n {
2746 template<typename T>
2747 [[nodiscard]]constexpr T* in_range(const constexpr_str_t<T>&pattern,array_like_view_t<T>range);
2748 //若成功找到匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2749 template<typename T>
2750 [[nodiscard]]constexpr size_t in_range_size_t(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
2751 auto result = in_range(pattern, range);
2752 if(result)
2753 return result - range.data();
2754 else
2755 return npos;
2756 }
2757 template<typename T>
2758 [[nodiscard]]constexpr T* in_range_but_reverse(const constexpr_str_t<T>&pattern,array_like_view_t<T>range);
2759 //若成功找到匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2760 template<typename T>
2761 [[nodiscard]]constexpr size_t in_range_but_reverse_size_t(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
2762 auto result = in_range_but_reverse(pattern, range);
2763 if(result)
2764 return result - range.data();
2765 else
2766 return npos;
2767 }
2768 template<typename T>
2769 [[nodiscard]]constexpr T* find_first_of(const constexpr_str_t<T>&pattern,array_like_view_t<T>range);
2770 //若成功找到匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2771 template<typename T>
2772 [[nodiscard]]constexpr size_t find_first_of_size_t(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
2773 auto result = find_first_of(pattern, range);
2774 if(result)
2775 return result - range.data();
2776 else
2777 return npos;
2778 }
2779 template<typename T>
2780 [[nodiscard]]constexpr T* find_last_of(const constexpr_str_t<T>&pattern,array_like_view_t<T>range);
2781 //若成功找到匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2782 template<typename T>
2783 [[nodiscard]]constexpr size_t find_last_of_size_t(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
2784 auto result = find_last_of(pattern, range);
2785 if(result)
2786 return result - range.data();
2787 else
2788 return npos;
2789 }
2790 template<typename T>
2791 [[nodiscard]]constexpr T* find_first_not_of(const constexpr_str_t<T>&pattern,array_like_view_t<T>range);
2792 //若成功找到不匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2793 template<typename T>
2794 [[nodiscard]]constexpr size_t find_first_not_of_size_t(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
2795 auto result = find_first_not_of(pattern, range);
2796 if(result)
2797 return result - range.data();
2798 else
2799 return npos;
2800 }
2801 template<typename T>
2802 [[nodiscard]]constexpr T* find_last_not_of(const constexpr_str_t<T>&pattern,array_like_view_t<T>range);
2803 //若成功找到不匹配的数据项,返回其距离开头的步数,若未找到,返回npos
2804 template<typename T>
2805 [[nodiscard]]constexpr T* find_last_not_of_size_t(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
2806 auto result = find_last_not_of(pattern,range);
2807 if(result)
2808 return result - range.begin();
2809 else
2810 return npos;
2811 }
2812 }
2813 //开始定义
2814 namespace string_view_n{
2815 //array_like_view_t的特化类型,表明这是字符串
2816 template<typename char_T>
2817 struct string_view_t:array_like_view_t<const char_T>{
2818 static constexpr size_t npos=range_n::npos;
2820 //构造函数
2821 using base_t::base_t;
2822 constexpr string_view_t(const char_T*str)noexcept:string_view_t(array_end_by_zero_t<const char_T>(str)){}
2823 //成员函数
2824 [[nodiscard]]constexpr const char_T*str()const noexcept{return base_t::cbegin();}
2825 [[nodiscard]]constexpr const char_T*data()const noexcept{return base_t::cbegin();}
2826 [[nodiscard]]constexpr operator const char_T*()const noexcept{return str();}
2827 //substr
2828 [[nodiscard]]constexpr string_view_t substr(size_t pos,size_t len)const noexcept{
2829 return string_view_t(base_t::cbegin()+pos,len);
2830 }
2831 [[nodiscard]]constexpr string_view_t substr(size_t pos)const noexcept{
2832 return string_view_t(base_t::cbegin()+pos,base_t::size()-pos);
2833 }
2834 [[nodiscard]]constexpr string_view_t substr(size_t pos,const char_T*end)const noexcept{
2835 return string_view_t(base_t::cbegin()+pos,end-base_t::cbegin());
2836 }
2837 [[nodiscard]]constexpr string_view_t substr(const char_T*begin,size_t len)const noexcept{
2838 return string_view_t(begin,len);
2839 }
2840 [[nodiscard]]constexpr string_view_t substr(const char_T*begin)const noexcept{
2841 return string_view_t(begin,base_t::size());
2842 }
2843 [[nodiscard]]constexpr string_view_t substr(const char_T*begin,const char_T*end)const noexcept{
2844 return string_view_t(begin,end-begin);
2845 }
2846 //find
2847 [[nodiscard]]constexpr size_t find(const char_T ch)const{
2848 return in_range_size_t(ch, *this);
2849 }
2850 [[nodiscard]]constexpr size_t reverse_find(const char_T ch)const{
2851 return in_range_but_reverse_size_t(ch, *this);
2852 }
2853 [[nodiscard]]constexpr size_t find(string_view_t str)const{
2854 return in_range_size_t(str, *this);
2855 }
2856 [[nodiscard]]constexpr size_t reverse_find(string_view_t str)const{
2857 return in_range_but_reverse_size_t(str, *this);
2858 }
2859 [[nodiscard]]constexpr size_t find(const constexpr_str_t<char_T>&str)const{
2860 return in_range_size_t(str, *this);
2861 }
2862 [[nodiscard]]constexpr size_t reverse_find(const constexpr_str_t<char_T>&str)const{
2863 return in_range_but_reverse_size_t(str, *this);
2864 }
2865 //others by range_n::find_last_of_size_t etc
2866 [[nodiscard]]constexpr size_t find_first_of(const char_T ch)const{
2867 return range_n::find_first_of_size_t(ch, *this);
2868 }
2869 [[nodiscard]]constexpr size_t find_last_of(const char_T ch)const{
2870 return range_n::find_last_of_size_t(ch, *this);
2871 }
2872 [[nodiscard]]constexpr size_t find_first_not_of(const char_T ch)const{
2873 return range_n::find_first_not_of_size_t(ch, *this);
2874 }
2875 [[nodiscard]]constexpr size_t find_last_not_of(const char_T ch)const{
2876 return range_n::find_last_not_of_size_t(ch, *this);
2877 }
2878 [[nodiscard]]constexpr size_t find_first_of(string_view_t str)const{
2879 return range_n::find_first_of_size_t(str, *this);
2880 }
2881 [[nodiscard]]constexpr size_t find_last_of(string_view_t str)const{
2882 return range_n::find_last_of_size_t(str, *this);
2883 }
2884 [[nodiscard]]constexpr size_t find_first_not_of(string_view_t str)const{
2885 return range_n::find_first_not_of_size_t(str, *this);
2886 }
2887 [[nodiscard]]constexpr size_t find_last_not_of(string_view_t str)const{
2888 return range_n::find_last_not_of_size_t(str, *this);
2889 }
2890 [[nodiscard]]constexpr size_t find_first_of(const constexpr_str_t<char_T>&str)const{
2891 return range_n::find_first_of_size_t(str, *this);
2892 }
2893 [[nodiscard]]constexpr size_t find_last_of(const constexpr_str_t<char_T>&str)const{
2894 return range_n::find_last_of_size_t(str, *this);
2895 }
2896 [[nodiscard]]constexpr size_t find_first_not_of(const constexpr_str_t<char_T>&str)const{
2897 return range_n::find_first_not_of_size_t(str, *this);
2898 }
2899 [[nodiscard]]constexpr size_t find_last_not_of(const constexpr_str_t<char_T>&str)const{
2900 return range_n::find_last_not_of_size_t(str, *this);
2901 }
2902 };
2904 }
2907
2908 //file_end
2909
2910 #line 32 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
2911 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/type_name.hpp"
2912 //type_name.hpp
2913 //at namespace elc::defs::base
2914 /*
2915 未完成的elc解释器base_defs文件
2916 由steve02081504与Alex0125设计、编写
2917 转载时请在不对此文件做任何修改的同时注明出处
2918 项目地址:https://github.com/steve02081504/ELC
2919 */
2921 //对于gcc和clang,这个类型有一个malloced的char*,以便于在析构时释放
2922 //一切源于abi::__cxa_demangle
2923 //对于msvc,这个类型析构时不需要做任何事情
2925 //重整器包装
2926 static base_t demangle(const char*original_name)noexcept{
2927 push_and_disable_msvc_warning(26494);//未初始化警告diss
2928 size_t len;
2929 const char*demangled_name;
2930 pop_msvc_warning();
2931 #if defined(__clang__)||defined(__GNUC__)
2932 //gcc和clang
2933 //使用abi::__cxa_demangle重整
2934 int status;
2935 demangled_name=::abi::__cxa_demangle(original_name,nullptr,&len,&status);
2936 if(status!=0){
2937 demangled_name=original_name;
2938 len=::std::strlen(original_name);
2939 ::std::free((void*)demangled_name);
2940 }
2941 #else
2942 //msvc
2943 //不需要重整
2944 demangled_name=original_name;
2945 len=::std::strlen(original_name);
2946 #endif
2947 return base_t{demangled_name,len};
2948 }
2949 //复制重整结果
2950 static base_t copy_demangle(base_t demangled_name)noexcept{
2951 #if defined(__clang__)||defined(__GNUC__)
2952 //gcc和clang
2953 //需要复制重整结果(用malloced的char*)
2954 char*copyed_name=(char*)::std::malloc(demangled_name.size()+1);
2955 if(copyed_name==nullptr)
2956 return base_t{nullptr,0};
2957 ::std::memcpy(copyed_name,demangled_name.data(),demangled_name.size());
2958 copyed_name[demangled_name.size()]='\0';
2959 return base_t{copyed_name,demangled_name.size()};
2960 #else
2961 //msvc
2962 //不需要复制重整结果
2963 return demangled_name;
2964 #endif
2965 }
2966 //构造函数
2967 type_name_t(const char*original_name)noexcept:base_t(demangle(original_name)){}
2968 //复制构造函数
2969 type_name_t(const type_name_t&other)noexcept:base_t(copy_demangle(other)){}
2970 //移动构造函数(swap)
2971 type_name_t(type_name_t&&other)noexcept:base_t(nullptr,0){
2972 swap_with(other);
2973 }
2974 //析构函数
2975 ~type_name_t()noexcept{
2976 #if defined(__clang__)||defined(__GNUC__)
2977 //gcc和clang
2978 //需要释放malloced的char*
2979 ::std::free((void*)begin());
2980 #endif
2981 }
2982 };
2983 [[nodiscard]]inline type_name_t base_type_info_t::get_name()const noexcept{
2984 return _tid.get_name();
2985 }
2986 [[nodiscard]]inline type_name_t base_type_info_t::type_id_t::get_name()const noexcept{
2987 return _m->name();
2988 }
2989 template<typename T>
2990 [[nodiscard]]inline type_name_t type_info_t<T>::get_name()const noexcept{
2991 return base_type_info_t(*this).get_name();
2992 }
2993
2994 //file_end
2995
2996 #line 33 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
2997 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/constexpr_str.hpp"
2998 //constexpr_str.hpp
2999 //at namespace elc::defs::base
3000 /*
3001 未完成的elc解释器base_defs文件
3002 由steve02081504与Alex0125设计、编写
3003 转载时请在不对此文件做任何修改的同时注明出处
3004 项目地址:https://github.com/steve02081504/ELC
3005 */
3006 namespace constexpr_str_n{
3007 //constexpr_str_t的退化类型,表明这是常量字符串,但没有可用的额外信息
3008 template<typename char_T>
3011 using base_t::base_t;
3012 constexpr_str_view_t(const char_T*str)noexcept=delete;
3013 //成员函数
3014 [[nodiscard]]constexpr const char_T*str()const noexcept{return base_t::cbegin();}
3015 [[nodiscard]]constexpr const char_T*data()const noexcept{return base_t::cbegin();}
3016 [[nodiscard]]constexpr operator const char_T*()const noexcept{return str();}
3017 //substr
3018 [[nodiscard]]constexpr constexpr_str_view_t substr(size_t pos,size_t len)const noexcept{
3019 return base_t::substr(pos,len);
3020 }
3021 [[nodiscard]]constexpr constexpr_str_view_t substr(size_t pos)const noexcept{
3022 return base_t::substr(pos);
3023 }
3024 [[nodiscard]]constexpr constexpr_str_view_t substr(size_t pos,const char_T*end)const noexcept{
3025 return base_t::substr(pos,end);
3026 }
3027 [[nodiscard]]constexpr constexpr_str_view_t substr(const char_T*begin,size_t len)const noexcept{
3028 return base_t::substr(begin,len);
3029 }
3030 [[nodiscard]]constexpr constexpr_str_view_t substr(const char_T*begin)const noexcept{
3031 return base_t::substr(begin);
3032 }
3033 [[nodiscard]]constexpr constexpr_str_view_t substr(const char_T*begin,const char_T*end)const noexcept{
3034 return base_t::substr(begin,end);
3035 }
3036 };
3037 //告知其他elc库接口这是编译时常量字符串,并提供编译时计算好的内容,包括但不限于hash、bmh头、bitmark等,用于加速库操作
3038 template<typename char_T>
3041 hash_t hash_result;
3045 bool is_bitmark_workable;
3046 constexpr constexpr_str_t(const char_T* str, size_t size):
3047 base_t(str, size),
3048 hash_result(defs::hash(str, size)),
3049 match_pattern(array_like_view_t<const char_T>{str, size}),
3050 reverse_match_pattern(array_like_view_t<const char_T>{str, size}){
3051 is_bitmark_workable = bitmark_for_finds.mark(*this);
3052 }
3053 constexpr constexpr_str_t(const char_T* str):constexpr_str_t(str,array_end_by_zero_t::get_length_of(str)){}
3054 [[nodiscard]]constexpr hash_t hash()const noexcept{return hash_result;}
3055 };
3056 template<class char_T,size_t N>
3058 const char_T* _array_begin;
3059 constexpr constexpr_str_t_literal_helper(const char_T(&str)[N])noexcept{
3060 _array_begin=str;
3061 }
3062 [[nodiscard]]constexpr auto get_constexpr_str_t()const noexcept{
3063 return constexpr_str_t{_array_begin,N-1};
3064 }
3065 };
3066 template<constexpr_str_t_literal_helper v>
3068 distinctive static constexpr auto value = v.get_constexpr_str_t();
3069 };
3070 //别问,问就是傻逼c++
3071 //告知其他elc库接口这是编译时常量字符串,并提供编译时计算好的内容,包括但不限于hash、bmh头、bitmark等,用于加速库操作
3072 template<constexpr_str_t_literal_helper str_helper>
3073 [[nodiscard]]inline consteval auto& operator ""_constexpr_str()noexcept{
3075 }
3076 //空字串常量且str或begin会指向一个0终止字符串(而不是nullptr),便于安全初始化
3077 template<class char_T>
3078 distinctive inline constexpr auto empty_constexpr_str_of = constexpr_str_t(&const_default_value_of<char_T>,0);
3079 };
3082 using constexpr_str_n::empty_constexpr_str_of;
3083 using constexpr_str_n::operator ""_constexpr_str;
3084
3085 //重载range操作
3086 namespace range_n {
3087 template<typename T>
3088 [[nodiscard]]constexpr T* in_range(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
3089 return pattern.match_pattern.match(range);
3090 }
3091 template<typename T>
3092 [[nodiscard]]constexpr T* in_range_but_reverse(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
3093 return pattern.reverse_match_pattern.match(range);
3094 }
3095 //find_first_of
3096 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
3097 template<typename T>
3098 [[nodiscard]]constexpr T* find_first_of(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
3099 if(pattern.is_bitmark_workable){
3100 return find_first_of_bitmark(pattern.bitmark_for_finds,range);
3101 }
3102 else{
3103 return find_first_of((const constexpr_str_view_t<T>&)pattern,range);
3104 }
3105 }
3106 //find_last_of
3107 //若成功找到匹配的数据项,返回其开头,若未找到,返回nullptr
3108 template<typename T>
3109 [[nodiscard]]constexpr T* find_last_of(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
3110 if(pattern.is_bitmark_workable){
3111 return find_last_of_bitmark(pattern.bitmark_for_finds,range);
3112 }
3113 else{
3114 return find_last_of((const constexpr_str_view_t<T>&)pattern,range);
3115 }
3116 }
3117 //find_first_not_of
3118 //若成功找到不匹配的数据项,返回其开头,若未找到,返回nullptr
3119 template<typename T>
3120 [[nodiscard]]constexpr T* find_first_not_of(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
3121 if(pattern.is_bitmark_workable){
3122 return find_first_not_of_bitmark(pattern.bitmark_for_finds,range);
3123 }
3124 else{
3125 return find_first_not_of((const constexpr_str_view_t<T>&)pattern,range);
3126 }
3127 }
3128 //find_last_not_of
3129 //若成功找到不匹配的数据项,返回其开头,若未找到,返回nullptr
3130 template<typename T>
3131 [[nodiscard]]constexpr T* find_last_not_of(const constexpr_str_t<T>&pattern,array_like_view_t<T>range){
3132 if(pattern.is_bitmark_workable){
3133 return find_last_not_of_bitmark(pattern.bitmark_for_finds,range);
3134 }
3135 else{
3136 return find_last_not_of((const constexpr_str_view_t<T>&)pattern,range);
3137 }
3138 }
3139 };
3140
3141 //file_end
3142
3143 #line 34 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
3144 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/logical_bool.hpp"
3145 //logic.hpp
3146 //at namespace elc::defs::base
3147 /*
3148 未完成的elc解释器base_defs文件
3149 由steve02081504与Alex0125设计、编写
3150 转载时请在不对此文件做任何修改的同时注明出处
3151 项目地址:https://github.com/steve02081504/ELC
3152 */
3153
3154 /*
3155 logical_bool:混沌布尔值。
3156 允许输出介于真假之间的内容的布尔值。
3157 混沌布尔值会有五个可能的值,分别为true,false,neither,either。unknown视为不合法。
3158 用在if与while中时,true,either被判定为真,其与均为假。
3159 用法:
3160 logical_bool(bool) 输出logical_bool,将布尔值转换为混沌布尔值。
3161 bool(logical_bool) 输出bool,将混沌布尔值转化为布尔值。
3162 允许与或非运算:输出结果仍然为混沌布尔值,参与运算的值如果有unknown则均输出unknown.
3163 允许判定相等,输出结果为混沌布尔值,参与运算的值如果有unknown则均输出unknown,否则仅有true和false两个合法值。
3164 */
3165 /*
3166 在 虚伪 的 信 念 之 前 - 他 们 将 三 元 论 视 为 真理
3167 所 有 的 东西 都 是 三 部 分 。
3168 从 那里 , 他 们 终于 获得 了 答案 。
3169 */
3171 private:
3172 [[no_unique_address]]bool _is_true;
3173 [[no_unique_address]]bool _is_false;
3174 [[no_unique_address]]bool _is_unknown;
3175 public:
3176 constexpr logical_bool(special_init_t,bool is_true,bool is_false,bool is_unknown=0):_is_true(is_true),_is_false(is_false),_is_unknown(is_unknown){}
3177 constexpr logical_bool(bool a):_is_true(a),_is_false(!a),_is_unknown(0){}
3178 constexpr logical_bool(const logical_bool&)=default;
3179 constexpr logical_bool&operator=(const logical_bool&)& =default;
3180 constexpr explicit operator bool()const{return _is_true && !_is_unknown;}
3181 constexpr logical_bool operator!()const{
3182 logical_bool aret=*this;
3183 swap(aret._is_true,aret._is_false);
3184 return aret;
3185 }
3186 friend logical_bool operator&&(logical_bool a,logical_bool b)noexcept{
3187 return logical_bool{special_init,a._is_true && b._is_true,a._is_false || b._is_false,a._is_unknown || b._is_unknown};
3188 }
3189 friend logical_bool operator||(logical_bool a,logical_bool b)noexcept{
3190 return logical_bool{special_init,a._is_true || b._is_true,a._is_false && b._is_false,a._is_unknown || b._is_unknown};
3191 }
3192 friend logical_bool operator==(logical_bool a,logical_bool b)noexcept{
3193 logical_bool aret(a._is_true == b._is_true && a._is_false == b._is_false);
3194 aret._is_unknown = a._is_unknown || b._is_unknown;
3195 return aret;
3196 }
3197 };
3198 constexpr logical_bool neither{special_init,0,0},either{special_init,1,1},unknown{special_init,0,0,1};
3199
3200 //file_end
3201
3202 #line 35 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
3203 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/zero.hpp"
3204 //zero.hpp
3205 //at namespace elc::defs::base
3206 /*
3207 未完成的elc解释器base_defs文件
3208 由steve02081504与Alex0125设计、编写
3209 转载时请在不对此文件做任何修改的同时注明出处
3210 项目地址:https://github.com/steve02081504/ELC
3211 */
3212 /*
3213 没什么用的语法糖,等价于字面量0.
3214 */
3215 constexpr struct zero_t{
3216 template<class T> requires(type_info<decltype(0)>.can_convert_to<T>)
3217 operator T()const noexcept(type_info<decltype(0)>.can_nothrow_convert_to<T>){return 0;}
3218 }zero{};
3219
3220 template<class T>
3221 constexpr inline bool is_all_byte_zero(T&&a){
3222 const byte*ptr=cast_to_data(addressof(a));
3223 const byte*end=ptr+sizeof(a);
3224 while(ptr!=end)
3225 if((unsigned char)(*ptr++))
3226 return false;
3227 return true;
3228 }
3229
3230 //file_end
3231
3232 #line 36 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
3233 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/count_able.hpp"
3234 //count_able.hpp
3235 //at namespace elc::defs::base
3236 /*
3237 未完成的elc解释器base_defs文件
3238 由steve02081504与Alex0125设计、编写
3239 转载时请在不对此文件做任何修改的同时注明出处
3240 项目地址:https://github.com/steve02081504/ELC
3241 */
3242 template<class T>
3243 [[nodiscard]]inline size_t the_number_of(type_info_t<T>)noexcept;
3244 template<class T>
3245 struct count_able:is_common_attribute(count_able){
3246 private:
3247 friend size_t the_number_of<T>(type_info_t<T>)noexcept;
3248 static size_t _number;
3249 public:
3250 count_able()noexcept{_number++;}
3251 ~count_able()noexcept{_number--;}
3252 };
3253 template<class T>
3254 [[nodiscard]]inline size_t the_number_of(type_info_t<T>)noexcept{
3255 if constexpr(type_info<T>.not_has_attribute(count_able))
3256 template_error("hey.");
3258 }
3259
3260 //file_end
3261
3262 #line 37 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
3263 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/invoke.hpp"
3264 //invoke.hpp
3265 //at namespace elc::defs::base
3266 /*
3267 未完成的elc解释器base_defs文件
3268 由steve02081504与Alex0125设计、编写
3269 转载时请在不对此文件做任何修改的同时注明出处
3270 项目地址:https://github.com/steve02081504/ELC
3271 */
3272 template<typename T>
3273 struct invoke_t{
3274 template<class...Args>
3275 static constexpr bool able= ::std::is_invocable_v<T,Args...>;
3276 template<class...Args>
3277 static constexpr bool nothrow= ::std::is_nothrow_invocable_v<T,Args...>;
3278
3279 template<class...Args> requires able<Args...>
3280 auto _as(Args&&...rest)const noexcept(nothrow<Args...>){//invoke<T>._as(...)
3281 return lambda_with_catch(rest...)(const T&a)noexcept(nothrow<Args...>){return a(forward<Args>(rest)...);};
3282 }
3283 };
3284 template<typename T>
3285 constexpr invoke_t<T>invoke{};
3286
3287 //file_end
3288
3289 #line 38 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
3290 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/maybe_fail_reference.hpp"
3291 //maybe_fail_reference.hpp
3292 //at namespace elc::defs::base
3293 /*
3294 未完成的elc解释器base_defs文件
3295 由steve02081504与Alex0125设计、编写
3296 转载时请在不对此文件做任何修改的同时注明出处
3297 项目地址:https://github.com/steve02081504/ELC
3298 */
3299 template<typename T>
3301 T*_ref_to;
3302 public:
3303 constexpr maybe_fail_reference(T&a):_ref_to(&a){}
3304 constexpr maybe_fail_reference(const maybe_fail_reference&)=default;
3305 constexpr maybe_fail_reference(note::fail_t):_ref_to(nullptr){}
3306
3307 [[nodiscard]]bool not_fail()noexcept{return _ref_to;}
3308 [[nodiscard]]bool fail()noexcept{return!not_fail();}
3309 T&get_ref()noexcept{return*_ref_to;}
3310 };
3311
3312 //file_end
3313
3314 #line 39 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/base_defs/_body.hpp"
3315
3316 //file_end
3317
3318 #line 30 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/_body.hpp"
3319 }
3320
3321 //由于vcruntime的type_info在全局定义,这里需要额外声明使用base::type_info.
3322 #if defined(_VCRUNTIME_H)
3323 using base::type_info;
3324 #endif
3325
3326 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
3327 //_undefs.hpp
3328 /*
3329 未完成的elc解释器basic文件
3330 由steve02081504与Alex0125设计、编写
3331 转载时请在不对此文件做任何修改的同时注明出处
3332 项目地址:https://github.com/steve02081504/ELC
3333 */
3334 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
3335 //_undefs.hpp
3336 /*
3337 未完成的elc解释器_share文件
3338 由steve02081504与Alex0125设计、编写
3339 转载时请在不对此文件做任何修改的同时注明出处
3340 项目地址:https://github.com/steve02081504/ELC
3341 */
3342
3343 //defs at "_defs.hpp"
3344
3345 #if defined(_MSC_VER)
3346 #pragma warning(pop)
3347 #endif
3348 #undef suppress_msvc_warning
3349 #undef disable_msvc_warning
3350 #undef push_msvc_warning
3351 #undef pop_msvc_warning
3352 #undef push_and_disable_msvc_warning
3353
3354 //for basic_environment.hpp
3355 #undef BIT_POSSIBILITY
3356 //
3357 #if defined(ELC_VOID_NAME)
3358 #define void the_void
3359 #endif
3360
3361 // #undef often_noexcept
3362 #undef noexcept_as
3363 #undef noexcept_as_auto
3364 #undef constexpr_as
3365 #undef constexpr_as_auto
3366
3367 #undef using_method_from_base_t
3368 #undef using_method_from_value
3369
3370 #undef floop
3371 #undef enable_adl
3372
3373 #undef re_declvalue
3374 #undef re_decltype
3375
3376 #undef declvalue
3377
3378 #undef template_error
3379 #undef template_warning
3380
3381 #undef type_info_of
3382 #undef type_name_of
3383
3384 #undef is_common_attribute
3385 #undef is_special_attribute
3386
3387 #undef has_attribute
3388 #undef not_has_attribute
3389
3390 #undef float_size_of
3391 #undef bitnum_of
3392
3393 #undef def_common_attribute_with_nothing
3394 #undef def_special_attribute_with_nothing
3395
3396 #undef common_attribute_t
3397 #undef special_attribute_t
3398
3399 #undef enable_if
3400 #undef enabled_by_default
3401 #undef disabled_by_default
3402 #undef enable_if_not_ill_form
3403 #undef enable_flag
3404
3405 #undef was_an_ill_form
3406 #undef was_an_ill_form_with_parameter
3407 #undef was_not_an_ill_form
3408 #undef was_not_an_ill_form_and_noexcept
3409 #undef was_not_an_ill_form_with_parameter
3410
3411 #undef recursive_lambda
3412 #undef get_recursive_lambda_caller
3413 #undef lambda
3414 #undef lambda_with_catch
3415 #undef self_recursion
3416 #undef lambda_RLSRRS
3417
3418 #undef MAGIC
3419
3420 #undef nothing
3421
3422 #undef elseif
3423 #undef _big_than_
3424 #undef _small_than_
3425
3426 #if defined(_MSC_VER)
3427 #undef not
3428 #undef and
3429 #undef or
3430 #endif
3431
3432 #undef INTER_NAMESPACE
3433 #undef BREAK_NAMESPACE
3434
3435 #undef szie
3436 #undef form
3437
3438 #undef template_name
3439 #undef type_name
3440
3441 #undef not_in_debug
3442
3443 #undef es
3444 #undef ec
3445
3446 #undef ELC_TEST_EVENTNAME
3447
3448 #undef override_instance_struct
3449
3450 #undef distinctive
3451
3452 #undef force_inline
3453
3454 #undef with_no_vtable
3455
3456 #undef in_consteval
3457
3458 #undef no_vtable_struct
3459 #undef no_vtable_class
3460
3461 //file_end
3462
3463 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
3464
3465 //file_end
3466
3467 #line 38 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_defs/_body.hpp"
3468 }
3469
3470 //file_end
3471
3472 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
3473 #endif
3474
3475 //file_end
3476
3477 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
3478 #include <cstring>//memcpy、memmove
3479 #include <atomic>//atomic
3480 #if defined(ELC_TEST_ON)
3481 #include <ctime>//time
3482 #endif
3483 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
3484 //_body.hpp
3485 //at namespace ::
3486 /*
3487 未完成的elc解释器base文件
3488 由steve02081504与Alex0125设计、编写
3489 转载时请在不对此文件做任何修改的同时注明出处
3490 项目地址:https://github.com/steve02081504/ELC
3491 */
3492 #if defined(ELC_TEST)//若已包含elc/test则报错:其应在此文件后被包含
3493 #error "this part cannot be tested."
3494 #endif
3495
3496 //include APIs:elc中可能根据编译环境而修改的底层函数
3497 //using at memory/alloc
3498 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc.hpp"
3499 //alloc.hpp
3500 /*
3501 未完成的elc解释器_share文件
3502 由steve02081504与Alex0125设计、编写
3503 转载时请在不对此文件做任何修改的同时注明出处
3504 项目地址:https://github.com/steve02081504/ELC
3505 */
3506 /*
3507 APIs说明
3508 elc依赖的基础函数.
3509 调整这些,实现快速移植,快速优化与行为自定义.
3510 */
3511 #if !defined(ELC_APIS_alloc)
3512 #define ELC_APIS_alloc
3513 #if defined(ELC_MEMORY_ALLOC_LOCATION_RECORD)
3514 #include <stacktrace>//for operate_source_location
3515 #endif
3516 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/_tools/decl_system_type.hpp"
3517 //decl_system_type.hpp
3518 /*
3519 未完成的elc解释器_share文件
3520 由steve02081504与Alex0125设计、编写
3521 转载时请在不对此文件做任何修改的同时注明出处
3522 项目地址:https://github.com/steve02081504/ELC
3523 */
3524 //copy&rewrite from steve02081504/steve.h
3525 #define linux 2
3526 #define windows 3
3527 #define other 4
3528 #if defined(__linux)||defined(__linux__)||defined(__gnu_linux__)
3529 #define SYSTEM_TYPE linux
3530 #elif defined(_WIN32)||defined(__MINGW32__)||defined(__CYGWIN__)
3531 #define SYSTEM_TYPE windows
3532 #else
3533 #define SYSTEM_TYPE other
3534 #endif
3535 #define ERROR_MSG_UNABLE_OS "Unable OS,edit this file on your own or contact ELC's producers."
3536
3537 //file_end
3538
3539 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc.hpp"
3540 #if SYSTEM_TYPE == windows
3541 #if defined(_DEBUG)
3542 #include <crtdbg.h>
3543 #else
3544 #include <malloc.h>
3545 #endif
3546 #else
3547 #include <cstdlib>
3548 #endif
3549 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
3550 //base_defs
3551 //at namespace ::
3552 /*
3553 未完成的elc解释器include文件
3554 由steve02081504与Alex0125设计、编写
3555 转载时请在不对此文件做任何修改的同时注明出处
3556 项目地址:https://github.com/steve02081504/ELC
3557 */
3558 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
3559
3560 //file_end
3561
3562 #line 28 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc.hpp"
3563 namespace elc::APIs::alloc{
3564 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
3565 //_defs.hpp
3566 /*
3567 未完成的elc解释器_share文件
3568 由steve02081504与Alex0125设计、编写
3569 转载时请在不对此文件做任何修改的同时注明出处
3570 项目地址:https://github.com/steve02081504/ELC
3571 */
3572
3573 //undefs at "_undefs.hpp"
3574
3575 //set ELC_WARNING_LEVEL default to 4(max)
3576 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
3577
3578 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
3579 //basic_environment.hpp
3580 /*
3581 未完成的elc解释器_share文件
3582 由steve02081504与Alex0125设计、编写
3583 转载时请在不对此文件做任何修改的同时注明出处
3584 项目地址:https://github.com/steve02081504/ELC
3585 */
3586
3587 //每个bit(不是字节)的可能性
3588 //为什么c艹委员会不定义这个?
3589 #define BIT_POSSIBILITY 2
3590
3591 //file_end
3592
3593 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
3594
3595 #if defined(_MSC_VER)
3596 #pragma warning(push,ELC_WARNING_LEVEL)
3597 #pragma warning(disable:4099)//class与struct混用警告diss
3598 #pragma warning(disable:26812)//enum class安利diss.
3599 #pragma warning(disable:4584)//重复子类警告diss
3600 #pragma warning(disable:4250)//域控制继承警告diss
3601 #pragma warning(disable:26432)//不完全默认方法警告diss
3602 #pragma warning(disable:26435)//virtual override方法警告diss
3603 #pragma warning(disable:26481)//容器安利diss
3604 #pragma warning(disable:26446)//gsl::at安利diss
3605 #pragma warning(disable:26434)//方法覆盖警告diss
3606 #pragma warning(disable:26429)//gsl::not_null安利diss
3607 #pragma warning(disable:26471)//对void*进行static_cast安利diss
3608 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
3609 #pragma warning(disable:26473)//相同指针显式cast警告diss
3610 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
3611 #pragma warning(disable:26485)//数组作指针警告diss
3612 #pragma warning(disable:26490)//reinterpret_cast警告diss
3613 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
3614 #pragma warning(disable:26482)//非常数数组索引警告diss
3615 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
3616 #endif
3617 #if defined(_MSC_VER)
3618 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
3619 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
3620 #define push_msvc_warning() __pragma(warning(push))
3621 #define pop_msvc_warning() __pragma(warning(pop))
3622 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
3623 #else
3624 #define suppress_msvc_warning(...)
3625 #define disable_msvc_warning(...)
3626 #define push_msvc_warning()
3627 #define pop_msvc_warning()
3628 #define push_and_disable_msvc_warning(...)
3629 #endif
3630 //
3631 #if defined(ELC_VOID_NAME)
3632 #undef void
3633 #endif
3634
3635 // #define often_noexcept
3636 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
3637 #define noexcept_as_auto MAGIC//哦现在有了
3638 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
3639 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
3640
3641 #define using_method_from_base_t(name,...) \
3642 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
3643 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
3644 {\
3645 return base_t::name(forward<Args>(rest)...);\
3646 }\
3647
3648 #define using_method_from_value(name,value_name,...) \
3649 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
3650 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
3651 {\
3652 return value_name.name(forward<Args>(rest)...);\
3653 }\
3654
3655 #define floop while(__builtin_is_my_dick_still_there())
3656 #define enable_adl(name) void name()noexcept=delete
3657
3658 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
3659 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
3660
3661 #define declvalue(...) (::std::declval<__VA_ARGS__>())
3662
3663 /*实例化到此将引发错误*/
3664 #define template_error(reason) static_assert(template_error_helper<T>,reason)
3665 /*实例化到此将引发警告*/
3666 #define template_warning(reason) template_warning_helper<T>(reason)
3667
3668 //for type_info
3669 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
3670 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
3671
3672 #define is_common_attribute(name) public attribute<T,name<T>>
3673 #define is_special_attribute(name) public attribute<T,name>
3674
3675 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
3676 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
3677
3678 //for float_size_t
3679 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
3680 //bitnum_of
3681 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
3682
3683 //for attribute
3684 #define def_common_attribute_with_nothing(name) \
3685 template<typename T>\
3686 class name{}\
3687
3688 #define def_special_attribute_with_nothing(name) \
3689 class name{}\
3690
3691 #define common_attribute_t template<class>class
3692 #define special_attribute_t class
3693
3694 /*
3695 若参数的布尔值为零,那么此模板不会实例化
3696
3697 为什么不用cpp20的constraints?
3698 1.不能类内定义
3699 2.不能作为模板参数
3700 一句话总结:c艹标准会sb
3701 */
3702 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
3703 /*默认参与模板候选*/
3704 #define enabled_by_default class enable_state=void
3705 /*默认不参与模板候选*/
3706 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
3707 /*若参数为病式,那么此模板不会实例化*/
3708 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
3709 /*用于模板声明*/
3710 #define enable_flag class enable_state
3711
3712 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
3713 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
3714 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
3715 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
3716 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
3717
3718 /*让lambda递归更加美观*/
3719 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
3720 /*让lambda递归更加美观*/
3721 #define get_recursive_lambda_caller(name) \
3722 lambda_with_catch(&)(auto&&...Args){\
3723 return name(name,Args...);\
3724 }
3725 /*让lambda定义更加美观*/
3726 #define lambda []
3727 /*让lambda定义更加美观*/
3728 #define lambda_with_catch(...) [__VA_ARGS__]
3729 /*让lambda递归更加美观*/
3730 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
3731 //recursive_lambda_self_referential_reserved_symbolname
3732 #define lambda_RLSRRS _my_jb_super_sb_name_
3733
3734 #define MAGIC//ahh,ko no tenno da!
3735
3736 /*装饰性语法糖*/
3737 #define nothing
3738
3739 /*aya风格语法糖*/
3740 #define elseif else if
3741 /*aya风格语法糖*/
3742 #define _big_than_ >
3743 /*aya风格语法糖*/
3744 #define _small_than_ <
3745
3746 #if defined(_MSC_VER)
3747 #define not !
3748 #define and &&
3749 #define or ||
3750 #endif
3751
3752 /*进入名称空间,并不是很美观*/
3753 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
3754 /*退出名称空间,并不是很美观*/
3755 #define BREAK_NAMESPACE }
3756
3757 /*template说明符*/
3758 #define template_name template
3759 /*template说明符*/
3760 #define type_name class
3761
3762 #if defined(DEBUG) || defined(_DEBUG)
3763 #define not_in_debug 0
3764 #else
3765 #define not_in_debug 1
3766 #endif
3767
3768 #define es U""
3769 #define ec(ch) U ## ch
3770
3771 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
3772 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
3773 #else
3774 #define ELC_TEST_EVENTNAME(name)
3775 #endif
3776
3777 #define override_instance_struct \
3778 protected:\
3779 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
3780 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
3781 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
3782 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
3783 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
3784
3785 #if defined(_WIN32)
3786 #define distinctive __declspec(dllexport)
3787 #else
3788 #define distinctive
3789 #endif
3790
3791 #if defined(_WIN32)
3792 #define force_inline __forceinline
3793 #elif defined(__GNUC__)
3794 #define force_inline __attribute__((always_inline)) inline
3795 #else
3796 #define force_inline inline
3797 #endif
3798
3799 #if defined(_WIN32)
3800 #define with_no_vtable __declspec(novtable)
3801 #else
3802 #define with_no_vtable
3803 #endif
3804
3805 #define in_consteval (::std::is_constant_evaluated())
3806
3807 #define no_vtable_struct struct with_no_vtable
3808 #define no_vtable_class class with_no_vtable
3809
3810 //file_end
3811
3812 #line 30 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc.hpp"
3813
3814 using namespace ::elc::defs;//remove_const||byte
3815 #if SYSTEM_TYPE != windows
3816 //overhead
3817 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc/default_method/overhead.hpp"
3818 //overhead.hpp
3819 //at namespace elc::APIs::alloc
3820 /*
3821 未完成的elc解释器base文件
3822 由steve02081504与Alex0125设计、编写
3823 转载时请在不对此文件做任何修改的同时注明出处
3824 项目地址:https://github.com/steve02081504/ELC
3825 */
3826 namespace overhead_n{
3827 using namespace ::elc::defs;
3828 constexpr size_t overhead_get_align(size_t align){
3829 return max(align,alignof(size_t));//保证最高对齐需求
3830 }
3831 constexpr size_t overhead_get_offset_value(size_t align){
3832 align=overhead_get_align(align);
3833 return (size_t(sizeof(size_t)/align)+bool(sizeof(size_t)%align))*align;//等同于sizeof(size_t)-sizeof(size_t)%align+(sizeof(size_t)%align?align:0)
3834 //暨,偏移量既要大于sizeof(size_t)以装下overhead,又要是align的整数倍以保证T实例的对齐被满足
3835 }
3836 constexpr size_t correct_size(size_t size,size_t align){
3837 return size+overhead_get_offset_value(align);
3838 }
3839 constexpr size_t correct_align(size_t align){
3840 return overhead_get_align(align);
3841 }
3842 inline pointer correct_pointer(pointer a,size_t align){
3843 return apply_off_set(a,overhead_get_offset_value(align));
3844 }
3845 inline pointer recorrect_pointer(pointer a,size_t align){
3846 return unapply_off_set(a,overhead_get_offset_value(align));
3847 }
3848 inline const_pointer recorrect_pointer(const_pointer a, size_t align){
3849 return unapply_off_set(a,overhead_get_offset_value(align));
3850 }
3851 inline void set_overhead(pointer a,size_t size){
3852 *reinterpret_cast<size_t*>(a)=size;
3853 }
3854 inline size_t get_overhead(const_pointer a){
3855 return*reinterpret_cast<const size_t*>(a);
3856 }
3857 }
3858
3859 //file_end
3860
3861 #line 34 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc.hpp"
3862 #endif
3863 //operate_source_location & source_location_guard
3864 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc/debug_info/source_location_guard.hpp"
3865 //source_location_guard.hpp
3866 //at namespace elc::APIs::alloc
3867 /*
3868 未完成的elc解释器base文件
3869 由steve02081504与Alex0125设计、编写
3870 转载时请在不对此文件做任何修改的同时注明出处
3871 项目地址:https://github.com/steve02081504/ELC
3872 */
3873 #if defined(_MSC_VER)
3874 #if defined(ELC_MEMORY_ALLOC_LOCATION_RECORD)
3875 #pragma detect_mismatch("ELC_MEMORY_ALLOC_LOCATION_RECORD","true")
3876 #else
3877 #pragma detect_mismatch("ELC_MEMORY_ALLOC_LOCATION_RECORD","false")
3878 #endif
3879 #endif
3880 #if defined(ELC_MEMORY_ALLOC_LOCATION_RECORD)
3881 distinctive inline ::std::stacktrace_entry operate_source_frame;
3882 distinctive inline struct source_location_info_t{
3883 const char*_file=nullptr;
3884 uint_least32_t _line=0;
3885 const char*file()noexcept{
3886 if(!_file){
3887 try{
3888 static ::std::string file_cache;
3889 file_cache=operate_source_frame.source_file();
3890 _file=file_cache.c_str();
3891 }
3892 catch(...){
3893 }
3894 }
3895 return _file;
3896 }
3897 uint_least32_t line()noexcept{
3898 if(!_line){
3899 try{
3900 _line=operate_source_frame.source_line();
3901 }
3902 catch(...){
3903 }
3904 }
3905 return _line;
3906 }
3907 void clear()noexcept{
3908 _file=nullptr;
3909 _line=0;
3910 }
3911 }operate_source_location;
3912 struct source_location_guard{
3913 bool is_set=false;
3914 source_location_guard(size_t lookup=0)noexcept{
3915 if(!operate_source_frame){
3916 ::std::stacktrace stack = ::std::stacktrace::current(/*skip*/lookup+2,/*max_depth*/1);
3917 if(stack.size()){
3918 operate_source_frame = stack[0];
3919 is_set = true;
3920 }
3921 }
3922 }
3923 ~source_location_guard()noexcept{
3924 if(is_set){
3925 operate_source_frame = ::std::stacktrace_entry{};
3926 operate_source_location.clear();
3927 }
3928 }
3929 };
3930 #else
3932 constexpr source_location_guard([[maybe_unused]]size_t lookup=0)noexcept{}
3933 };
3934 distinctive inline struct source_location_info_t{
3935 constexpr const char*file()noexcept{return nullptr;}
3936 constexpr uint_least32_t line()noexcept{return 0;}
3937 }operate_source_location;
3938 #endif
3939
3940 //file_end
3941
3942 #line 36 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc.hpp"
3943
3944 //BLOCK: Counting memory allocations
3945 #if defined(_MSC_VER)
3946 #if defined(ELC_TEST_COUNT_MEMORY_ALLOC)
3947 #pragma detect_mismatch("ELC_TEST_COUNT_MEMORY_ALLOC","true")
3948 #else
3949 #pragma detect_mismatch("ELC_TEST_COUNT_MEMORY_ALLOC","false")
3950 #endif
3951 #endif
3952
3953 #if defined(ELC_TEST_COUNT_MEMORY_ALLOC)
3954 [[nodiscard]]inline size_t get_size_of_alloc(const byte*p,size_t align)noexcept;
3955 namespace count_info{
3956 distinctive inline size_t alloc_count=0;
3957 distinctive inline size_t free_count=0;
3958 distinctive inline size_t alloc_size=0;
3959 distinctive inline size_t free_size=0;
3960 distinctive inline size_t memory_using=0;
3961 distinctive inline size_t memory_using_max=0;
3962 inline void update_memory_using(ptrdiff_t diff)noexcept{
3963 memory_using+=diff;
3964 if(memory_using>memory_using_max)
3965 memory_using_max=memory_using;
3966 }
3967 inline void clear()noexcept{
3968 alloc_count=0;
3969 free_count=0;
3970 alloc_size=0;
3971 free_size=0;
3972 memory_using=0;
3973 memory_using_max=0;
3974 }
3975 }
3976 #endif
3977 //BLOCK_END
3978
3979 /*
3980 aligned_alloc 内存分配函数,需提供对齐需求
3981 return空指针被允许
3982 size被保证不为0
3983 */
3984 [[nodiscard]]inline byte*aligned_alloc(size_t align,size_t size)noexcept{
3985 void* aret;//返回值放这里
3986
3987 #if SYSTEM_TYPE == windows
3988 #if defined(_DEBUG)
3989 aret = _aligned_malloc_dbg(size,align,operate_source_location.file(),operate_source_location.line());
3990 #else
3991 aret = _aligned_malloc(size,align);
3992 #endif
3993 #else
3994 using namespace overhead_n;
3995 void*tmp=::std::aligned_alloc(correct_align(align),correct_size(size,align));
3996 if(tmp){
3997 set_overhead(tmp,size);
3998 aret = correct_pointer(tmp,align);
3999 }
4000 else
4001 aret = nullptr;
4002 #endif
4003
4004 #if defined(ELC_TEST_COUNT_MEMORY_ALLOC)
4005 if(aret){
4006 count_info::alloc_count++;
4007 count_info::alloc_size+=size;
4008 count_info::update_memory_using(size);
4009 }
4010 #endif
4011
4012 return(byte*)aret;
4013 }
4014 /*
4015 realloc 重新规划分配的大小
4016 return空指针被允许,但ptr值必须保持有效以保证gc后再次realloc有效
4017 new_size被保证不为0
4018 align维持不变
4019 但只允许在扩大数据块时可选的移动数据块
4020 */
4021 [[nodiscard]]inline byte*realloc(byte*ptr,size_t nsize,[[maybe_unused]]size_t align)noexcept{
4022 #if defined(ELC_TEST_COUNT_MEMORY_ALLOC)
4023 const auto osize=get_size_of_alloc(ptr,align);
4024 #endif
4025 void* aret;//返回值放这里
4026
4027 #if SYSTEM_TYPE == windows
4028 #if defined(_DEBUG)
4029 aret = _aligned_realloc_dbg(ptr,nsize,align,operate_source_location.file(),operate_source_location.line());
4030 #else
4031 aret = _aligned_realloc(ptr,nsize,align);
4032 #endif
4033 #else
4034 using namespace overhead_n;
4035 void*tmp=::std::realloc(recorrect_pointer(ptr,align),correct_size(nsize,align));
4036 if(tmp){
4037 set_overhead(tmp,nsize);
4038 aret = correct_pointer(tmp,align);
4039 }
4040 else
4041 aret = nullptr;
4042 #endif
4043
4044 #if defined(ELC_TEST_COUNT_MEMORY_ALLOC)
4045 if(aret){
4046 count_info::alloc_size+=nsize-osize;
4047 count_info::update_memory_using(nsize-osize);
4048 }
4049 #endif
4050
4051 return(byte*)aret;
4052 }
4053 /*
4054 free 释放所分配的内存
4055 传入需获取大小的数据块起始点与对齐
4056 */
4057 inline void free(byte*p,[[maybe_unused]]size_t align)noexcept{
4058 #if defined(ELC_TEST_COUNT_MEMORY_ALLOC)
4059 const auto size=get_size_of_alloc(p,align);
4060 count_info::free_count++;
4061 count_info::free_size+=size;
4062 count_info::update_memory_using(-ptrdiff_t(size));
4063 #endif
4064
4065 #if SYSTEM_TYPE == windows
4066 #if defined(_DEBUG)
4067 _aligned_free_dbg(p);
4068 #else
4069 _aligned_free(p);
4070 #endif
4071 #else
4072 using namespace overhead_n;
4073 ::std::free(recorrect_pointer(p,align));
4074 #endif
4075 }
4076 /*
4077 get_size_of_alloc 获取数据块的大小
4078 传入需获取大小的数据块起始点与对齐
4079 */
4080 [[nodiscard]]inline size_t get_size_of_alloc(const byte*p,[[maybe_unused]]size_t align)noexcept{
4081 #if SYSTEM_TYPE == windows
4082 #if defined(_DEBUG)
4083 return _aligned_msize_dbg(remove_const(p),align,0);
4084 #else
4085 return _aligned_msize(remove_const(p),align,0);
4086 #endif
4087 #else
4088 using namespace overhead_n;
4089 return get_overhead(recorrect_pointer(p,align));
4090 #endif
4091 }
4092
4093 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
4094 //_undefs.hpp
4095 /*
4096 未完成的elc解释器_share文件
4097 由steve02081504与Alex0125设计、编写
4098 转载时请在不对此文件做任何修改的同时注明出处
4099 项目地址:https://github.com/steve02081504/ELC
4100 */
4101
4102 //defs at "_defs.hpp"
4103
4104 #if defined(_MSC_VER)
4105 #pragma warning(pop)
4106 #endif
4107 #undef suppress_msvc_warning
4108 #undef disable_msvc_warning
4109 #undef push_msvc_warning
4110 #undef pop_msvc_warning
4111 #undef push_and_disable_msvc_warning
4112
4113 //for basic_environment.hpp
4114 #undef BIT_POSSIBILITY
4115 //
4116 #if defined(ELC_VOID_NAME)
4117 #define void the_void
4118 #endif
4119
4120 // #undef often_noexcept
4121 #undef noexcept_as
4122 #undef noexcept_as_auto
4123 #undef constexpr_as
4124 #undef constexpr_as_auto
4125
4126 #undef using_method_from_base_t
4127 #undef using_method_from_value
4128
4129 #undef floop
4130 #undef enable_adl
4131
4132 #undef re_declvalue
4133 #undef re_decltype
4134
4135 #undef declvalue
4136
4137 #undef template_error
4138 #undef template_warning
4139
4140 #undef type_info_of
4141 #undef type_name_of
4142
4143 #undef is_common_attribute
4144 #undef is_special_attribute
4145
4146 #undef has_attribute
4147 #undef not_has_attribute
4148
4149 #undef float_size_of
4150 #undef bitnum_of
4151
4152 #undef def_common_attribute_with_nothing
4153 #undef def_special_attribute_with_nothing
4154
4155 #undef common_attribute_t
4156 #undef special_attribute_t
4157
4158 #undef enable_if
4159 #undef enabled_by_default
4160 #undef disabled_by_default
4161 #undef enable_if_not_ill_form
4162 #undef enable_flag
4163
4164 #undef was_an_ill_form
4165 #undef was_an_ill_form_with_parameter
4166 #undef was_not_an_ill_form
4167 #undef was_not_an_ill_form_and_noexcept
4168 #undef was_not_an_ill_form_with_parameter
4169
4170 #undef recursive_lambda
4171 #undef get_recursive_lambda_caller
4172 #undef lambda
4173 #undef lambda_with_catch
4174 #undef self_recursion
4175 #undef lambda_RLSRRS
4176
4177 #undef MAGIC
4178
4179 #undef nothing
4180
4181 #undef elseif
4182 #undef _big_than_
4183 #undef _small_than_
4184
4185 #if defined(_MSC_VER)
4186 #undef not
4187 #undef and
4188 #undef or
4189 #endif
4190
4191 #undef INTER_NAMESPACE
4192 #undef BREAK_NAMESPACE
4193
4194 #undef szie
4195 #undef form
4196
4197 #undef template_name
4198 #undef type_name
4199
4200 #undef not_in_debug
4201
4202 #undef es
4203 #undef ec
4204
4205 #undef ELC_TEST_EVENTNAME
4206
4207 #undef override_instance_struct
4208
4209 #undef distinctive
4210
4211 #undef force_inline
4212
4213 #undef with_no_vtable
4214
4215 #undef in_consteval
4216
4217 #undef no_vtable_struct
4218 #undef no_vtable_class
4219
4220 //file_end
4221
4222 #line 187 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc.hpp"
4223 }
4224 //
4225 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/_tools/undef_decl_system_type.hpp"
4226 //undef_decl_system_type.hpp
4227 /*
4228 未完成的elc解释器_share文件
4229 由steve02081504与Alex0125设计、编写
4230 转载时请在不对此文件做任何修改的同时注明出处
4231 项目地址:https://github.com/steve02081504/ELC
4232 */
4233 //copy&rewrite from steve02081504/evest.h
4234 #undef linux
4235 #undef windows
4236 #undef other
4237 #undef SYSTEM_TYPE
4238 #undef ERROR_MSG_UNABLE_OS
4239
4240 //file_end
4241
4242 #line 190 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/alloc.hpp"
4243 #endif
4244
4245 //file_end
4246
4247 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
4248 //using at memory/gc
4249 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/die.hpp"
4250 //die.hpp
4251 /*
4252 未完成的elc解释器_share文件
4253 由steve02081504与Alex0125设计、编写
4254 转载时请在不对此文件做任何修改的同时注明出处
4255 项目地址:https://github.com/steve02081504/ELC
4256 */
4257 /*
4258 APIs说明
4259 elc依赖的基础函数.
4260 调整这些,实现快速移植,快速优化与行为自定义.
4261 */
4262 #if !defined(ELC_APIS_die)
4263 #define ELC_APIS_die
4264 #include <cuchar>
4265 #include <clocale>
4266 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/default_data_type.hpp"
4267 //default_data_type.hpp
4268 /*
4269 未完成的elc解释器_share文件
4270 由steve02081504与Alex0125设计、编写
4271 转载时请在不对此文件做任何修改的同时注明出处
4272 项目地址:https://github.com/steve02081504/ELC
4273 */
4274 namespace elc{
4275 /*ELC内部string统一采用char_t宽字符,使用setlocale(LC_ALL,"en_US.utf8")下的UTF编码。*/
4276 typedef char32_t char_t;
4277 /*ELC内部钦定int_t类型*/
4278 typedef int64_t int_t;
4279 /*ELC内部钦定uint_t类型*/
4280 typedef uint64_t uint_t;
4281 /*ELC内部钦定float_t类型*/
4282 typedef double float_t;
4283 /*ELC内部钦定float_size_t类型,用以描述内存大小的浮点状况*/
4284 typedef long double float_size_t;
4285 }
4286
4287 //file_end
4288
4289 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/die.hpp"
4290 namespace elc::APIs::die{
4291 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
4292 //_defs.hpp
4293 /*
4294 未完成的elc解释器_share文件
4295 由steve02081504与Alex0125设计、编写
4296 转载时请在不对此文件做任何修改的同时注明出处
4297 项目地址:https://github.com/steve02081504/ELC
4298 */
4299
4300 //undefs at "_undefs.hpp"
4301
4302 //set ELC_WARNING_LEVEL default to 4(max)
4303 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
4304
4305 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
4306 //basic_environment.hpp
4307 /*
4308 未完成的elc解释器_share文件
4309 由steve02081504与Alex0125设计、编写
4310 转载时请在不对此文件做任何修改的同时注明出处
4311 项目地址:https://github.com/steve02081504/ELC
4312 */
4313
4314 //每个bit(不是字节)的可能性
4315 //为什么c艹委员会不定义这个?
4316 #define BIT_POSSIBILITY 2
4317
4318 //file_end
4319
4320 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
4321
4322 #if defined(_MSC_VER)
4323 #pragma warning(push,ELC_WARNING_LEVEL)
4324 #pragma warning(disable:4099)//class与struct混用警告diss
4325 #pragma warning(disable:26812)//enum class安利diss.
4326 #pragma warning(disable:4584)//重复子类警告diss
4327 #pragma warning(disable:4250)//域控制继承警告diss
4328 #pragma warning(disable:26432)//不完全默认方法警告diss
4329 #pragma warning(disable:26435)//virtual override方法警告diss
4330 #pragma warning(disable:26481)//容器安利diss
4331 #pragma warning(disable:26446)//gsl::at安利diss
4332 #pragma warning(disable:26434)//方法覆盖警告diss
4333 #pragma warning(disable:26429)//gsl::not_null安利diss
4334 #pragma warning(disable:26471)//对void*进行static_cast安利diss
4335 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
4336 #pragma warning(disable:26473)//相同指针显式cast警告diss
4337 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
4338 #pragma warning(disable:26485)//数组作指针警告diss
4339 #pragma warning(disable:26490)//reinterpret_cast警告diss
4340 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
4341 #pragma warning(disable:26482)//非常数数组索引警告diss
4342 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
4343 #endif
4344 #if defined(_MSC_VER)
4345 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
4346 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
4347 #define push_msvc_warning() __pragma(warning(push))
4348 #define pop_msvc_warning() __pragma(warning(pop))
4349 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
4350 #else
4351 #define suppress_msvc_warning(...)
4352 #define disable_msvc_warning(...)
4353 #define push_msvc_warning()
4354 #define pop_msvc_warning()
4355 #define push_and_disable_msvc_warning(...)
4356 #endif
4357 //
4358 #if defined(ELC_VOID_NAME)
4359 #undef void
4360 #endif
4361
4362 // #define often_noexcept
4363 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
4364 #define noexcept_as_auto MAGIC//哦现在有了
4365 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
4366 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
4367
4368 #define using_method_from_base_t(name,...) \
4369 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
4370 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
4371 {\
4372 return base_t::name(forward<Args>(rest)...);\
4373 }\
4374
4375 #define using_method_from_value(name,value_name,...) \
4376 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
4377 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
4378 {\
4379 return value_name.name(forward<Args>(rest)...);\
4380 }\
4381
4382 #define floop while(__builtin_is_my_dick_still_there())
4383 #define enable_adl(name) void name()noexcept=delete
4384
4385 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
4386 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
4387
4388 #define declvalue(...) (::std::declval<__VA_ARGS__>())
4389
4390 /*实例化到此将引发错误*/
4391 #define template_error(reason) static_assert(template_error_helper<T>,reason)
4392 /*实例化到此将引发警告*/
4393 #define template_warning(reason) template_warning_helper<T>(reason)
4394
4395 //for type_info
4396 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
4397 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
4398
4399 #define is_common_attribute(name) public attribute<T,name<T>>
4400 #define is_special_attribute(name) public attribute<T,name>
4401
4402 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
4403 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
4404
4405 //for float_size_t
4406 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
4407 //bitnum_of
4408 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
4409
4410 //for attribute
4411 #define def_common_attribute_with_nothing(name) \
4412 template<typename T>\
4413 class name{}\
4414
4415 #define def_special_attribute_with_nothing(name) \
4416 class name{}\
4417
4418 #define common_attribute_t template<class>class
4419 #define special_attribute_t class
4420
4421 /*
4422 若参数的布尔值为零,那么此模板不会实例化
4423
4424 为什么不用cpp20的constraints?
4425 1.不能类内定义
4426 2.不能作为模板参数
4427 一句话总结:c艹标准会sb
4428 */
4429 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
4430 /*默认参与模板候选*/
4431 #define enabled_by_default class enable_state=void
4432 /*默认不参与模板候选*/
4433 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
4434 /*若参数为病式,那么此模板不会实例化*/
4435 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
4436 /*用于模板声明*/
4437 #define enable_flag class enable_state
4438
4439 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
4440 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
4441 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
4442 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
4443 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
4444
4445 /*让lambda递归更加美观*/
4446 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
4447 /*让lambda递归更加美观*/
4448 #define get_recursive_lambda_caller(name) \
4449 lambda_with_catch(&)(auto&&...Args){\
4450 return name(name,Args...);\
4451 }
4452 /*让lambda定义更加美观*/
4453 #define lambda []
4454 /*让lambda定义更加美观*/
4455 #define lambda_with_catch(...) [__VA_ARGS__]
4456 /*让lambda递归更加美观*/
4457 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
4458 //recursive_lambda_self_referential_reserved_symbolname
4459 #define lambda_RLSRRS _my_jb_super_sb_name_
4460
4461 #define MAGIC//ahh,ko no tenno da!
4462
4463 /*装饰性语法糖*/
4464 #define nothing
4465
4466 /*aya风格语法糖*/
4467 #define elseif else if
4468 /*aya风格语法糖*/
4469 #define _big_than_ >
4470 /*aya风格语法糖*/
4471 #define _small_than_ <
4472
4473 #if defined(_MSC_VER)
4474 #define not !
4475 #define and &&
4476 #define or ||
4477 #endif
4478
4479 /*进入名称空间,并不是很美观*/
4480 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
4481 /*退出名称空间,并不是很美观*/
4482 #define BREAK_NAMESPACE }
4483
4484 /*template说明符*/
4485 #define template_name template
4486 /*template说明符*/
4487 #define type_name class
4488
4489 #if defined(DEBUG) || defined(_DEBUG)
4490 #define not_in_debug 0
4491 #else
4492 #define not_in_debug 1
4493 #endif
4494
4495 #define es U""
4496 #define ec(ch) U ## ch
4497
4498 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
4499 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
4500 #else
4501 #define ELC_TEST_EVENTNAME(name)
4502 #endif
4503
4504 #define override_instance_struct \
4505 protected:\
4506 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
4507 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
4508 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
4509 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
4510 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
4511
4512 #if defined(_WIN32)
4513 #define distinctive __declspec(dllexport)
4514 #else
4515 #define distinctive
4516 #endif
4517
4518 #if defined(_WIN32)
4519 #define force_inline __forceinline
4520 #elif defined(__GNUC__)
4521 #define force_inline __attribute__((always_inline)) inline
4522 #else
4523 #define force_inline inline
4524 #endif
4525
4526 #if defined(_WIN32)
4527 #define with_no_vtable __declspec(novtable)
4528 #else
4529 #define with_no_vtable
4530 #endif
4531
4532 #define in_consteval (::std::is_constant_evaluated())
4533
4534 #define no_vtable_struct struct with_no_vtable
4535 #define no_vtable_class class with_no_vtable
4536
4537 //file_end
4538
4539 #line 19 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/die.hpp"
4540
4541 [[noreturn]]inline void die()noexcept{
4542 #if defined(_MSC_VER)
4543 __debugbreak();
4544 #endif
4545 #if defined(_WINMAIN_)
4546 ::MessageBoxW(NULL,L"elc died.",NULL,MB_ICONERROR);
4547 #else
4548 ::std::fputs("elc died.\n",stderr);
4549 ::std::fflush(stderr);
4550 #endif
4551 ::std::abort();
4552 }
4553 [[noreturn]]inline void die_with(const char_t*err_msg)noexcept{
4554 #if defined(_MSC_VER)
4555 __debugbreak();
4556 #endif
4557 push_and_disable_msvc_warning(
4558 26485//数组转型警告diss
4559 26475//强转警告diss
4560 26481//指针操作警告diss
4561 26429//nullness警告diss
4562 )
4563 if(err_msg){
4564 ::std::mbstate_t stat{};
4565 if(::std::setlocale(LC_CTYPE,"en_US.utf8")==nullptr)
4566 die();
4567 push_and_disable_msvc_warning(26494);//未初始化警告diss
4568 char err_msg_in_char[2048];
4569 char* err_msg_write = err_msg_in_char;
4570 size_t s;
4571 char_t c;
4572 pop_msvc_warning();
4573 floop{
4574 c=*err_msg++;
4575 if(c==0)
4576 break;
4577 s = ::std::c32rtomb(err_msg_write, c, &stat);
4578 if(s == size_t(-1))
4579 die();
4580 err_msg_write += s;
4581 }
4582 *err_msg_write = '\0';
4583 #if defined(_WINMAIN_)
4584 wchar_t err_msg_in_wchar[2048];
4585 MultiByteToWideChar(CP_UTF8, 0, err_msg_in_char, -1, err_msg_in_wchar, 2048);
4586 ::MessageBoxW(NULL,err_msg_in_wchar,NULL,MB_ICONERROR);
4587 #else
4588 ::std::fputs("elc died because:\n",stderr);
4589 ::std::fputs(err_msg_in_char,stderr);
4590 ::std::fputc('\n',stderr);
4591 ::std::fflush(stderr);
4592 #endif
4593 }
4594 ::std::abort();
4595 pop_msvc_warning();
4596 }
4597
4598 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
4599 //_undefs.hpp
4600 /*
4601 未完成的elc解释器_share文件
4602 由steve02081504与Alex0125设计、编写
4603 转载时请在不对此文件做任何修改的同时注明出处
4604 项目地址:https://github.com/steve02081504/ELC
4605 */
4606
4607 //defs at "_defs.hpp"
4608
4609 #if defined(_MSC_VER)
4610 #pragma warning(pop)
4611 #endif
4612 #undef suppress_msvc_warning
4613 #undef disable_msvc_warning
4614 #undef push_msvc_warning
4615 #undef pop_msvc_warning
4616 #undef push_and_disable_msvc_warning
4617
4618 //for basic_environment.hpp
4619 #undef BIT_POSSIBILITY
4620 //
4621 #if defined(ELC_VOID_NAME)
4622 #define void the_void
4623 #endif
4624
4625 // #undef often_noexcept
4626 #undef noexcept_as
4627 #undef noexcept_as_auto
4628 #undef constexpr_as
4629 #undef constexpr_as_auto
4630
4631 #undef using_method_from_base_t
4632 #undef using_method_from_value
4633
4634 #undef floop
4635 #undef enable_adl
4636
4637 #undef re_declvalue
4638 #undef re_decltype
4639
4640 #undef declvalue
4641
4642 #undef template_error
4643 #undef template_warning
4644
4645 #undef type_info_of
4646 #undef type_name_of
4647
4648 #undef is_common_attribute
4649 #undef is_special_attribute
4650
4651 #undef has_attribute
4652 #undef not_has_attribute
4653
4654 #undef float_size_of
4655 #undef bitnum_of
4656
4657 #undef def_common_attribute_with_nothing
4658 #undef def_special_attribute_with_nothing
4659
4660 #undef common_attribute_t
4661 #undef special_attribute_t
4662
4663 #undef enable_if
4664 #undef enabled_by_default
4665 #undef disabled_by_default
4666 #undef enable_if_not_ill_form
4667 #undef enable_flag
4668
4669 #undef was_an_ill_form
4670 #undef was_an_ill_form_with_parameter
4671 #undef was_not_an_ill_form
4672 #undef was_not_an_ill_form_and_noexcept
4673 #undef was_not_an_ill_form_with_parameter
4674
4675 #undef recursive_lambda
4676 #undef get_recursive_lambda_caller
4677 #undef lambda
4678 #undef lambda_with_catch
4679 #undef self_recursion
4680 #undef lambda_RLSRRS
4681
4682 #undef MAGIC
4683
4684 #undef nothing
4685
4686 #undef elseif
4687 #undef _big_than_
4688 #undef _small_than_
4689
4690 #if defined(_MSC_VER)
4691 #undef not
4692 #undef and
4693 #undef or
4694 #endif
4695
4696 #undef INTER_NAMESPACE
4697 #undef BREAK_NAMESPACE
4698
4699 #undef szie
4700 #undef form
4701
4702 #undef template_name
4703 #undef type_name
4704
4705 #undef not_in_debug
4706
4707 #undef es
4708 #undef ec
4709
4710 #undef ELC_TEST_EVENTNAME
4711
4712 #undef override_instance_struct
4713
4714 #undef distinctive
4715
4716 #undef force_inline
4717
4718 #undef with_no_vtable
4719
4720 #undef in_consteval
4721
4722 #undef no_vtable_struct
4723 #undef no_vtable_class
4724
4725 //file_end
4726
4727 #line 78 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/die.hpp"
4728 }
4729 namespace elc::defs{
4730 using namespace elc::APIs::die;
4731 }
4732 #endif
4733
4734 //file_end
4735
4736 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
4737 //include locale:自然语言相关的字符串
4738 //strings
4739 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
4740 //using.hpp
4741 /*
4742 未完成的elc解释器_share文件
4743 由steve02081504与Alex0125设计、编写
4744 转载时请在不对此文件做任何修改的同时注明出处
4745 项目地址:https://github.com/steve02081504/ELC
4746 */
4747 /*
4748 locale说明
4749 elc使用的字符串.
4750 调整这些,实现快速本地化.
4751 */
4752 #if !defined(ELC_LOCALE)
4753 #define ELC_LOCALE
4754 #include <locale>
4755 //
4756 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/default_data_type.hpp"
4757 //default_data_type.hpp
4758 /*
4759 未完成的elc解释器_share文件
4760 由steve02081504与Alex0125设计、编写
4761 转载时请在不对此文件做任何修改的同时注明出处
4762 项目地址:https://github.com/steve02081504/ELC
4763 */
4764 namespace elc{
4765 /*ELC内部string统一采用char_t宽字符,使用setlocale(LC_ALL,"en_US.utf8")下的UTF编码。*/
4766 typedef char32_t char_t;
4767 /*ELC内部钦定int_t类型*/
4768 typedef int64_t int_t;
4769 /*ELC内部钦定uint_t类型*/
4770 typedef uint64_t uint_t;
4771 /*ELC内部钦定float_t类型*/
4772 typedef double float_t;
4773 /*ELC内部钦定float_size_t类型,用以描述内存大小的浮点状况*/
4774 typedef long double float_size_t;
4775 }
4776
4777 //file_end
4778
4779 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
4780 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/_char.hpp"
4781 //_char.hpp
4782 /*
4783 未完成的elc解释器_share文件
4784 由steve02081504与Alex0125设计、编写
4785 转载时请在不对此文件做任何修改的同时注明出处
4786 项目地址:https://github.com/steve02081504/ELC
4787 */
4788 namespace elc::defs::locale{
4789 inline const ::std::locale default_locale{"en_US.utf8"};
4790 namespace char_n{
4791 template <class charT> bool isspace (charT c){ return isspace (c,default_locale); }
4792 template <class charT> bool isprint (charT c){ return isprint (c,default_locale); }
4793 template <class charT> bool iscntrl (charT c){ return iscntrl (c,default_locale); }
4794 template <class charT> bool isupper (charT c){ return isupper (c,default_locale); }
4795 template <class charT> bool islower (charT c){ return islower (c,default_locale); }
4796 template <class charT> bool isalpha (charT c){ return isalpha (c,default_locale); }
4797 template <class charT> bool isdigit (charT c){ return isdigit (c,default_locale); }
4798 template <class charT> bool ispunct (charT c){ return ispunct (c,default_locale); }
4799 template <class charT> bool isxdigit(charT c){ return isxdigit(c,default_locale); }
4800 template <class charT> bool isalnum (charT c){ return isalnum (c,default_locale); }
4801 template <class charT> bool isgraph (charT c){ return isgraph (c,default_locale); }
4802 template <class charT> charT toupper(charT c){ return toupper (c,default_locale); }
4803 template <class charT> charT tolower(charT c){ return tolower (c,default_locale); }
4804 }
4805 }
4806
4807 //file_end
4808
4809 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
4810 //
4811 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
4812 //base_defs
4813 //at namespace ::
4814 /*
4815 未完成的elc解释器include文件
4816 由steve02081504与Alex0125设计、编写
4817 转载时请在不对此文件做任何修改的同时注明出处
4818 项目地址:https://github.com/steve02081504/ELC
4819 */
4820 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
4821
4822 //file_end
4823
4824 #line 20 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
4825 //
4826 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
4827 //_defs.hpp
4828 /*
4829 未完成的elc解释器_share文件
4830 由steve02081504与Alex0125设计、编写
4831 转载时请在不对此文件做任何修改的同时注明出处
4832 项目地址:https://github.com/steve02081504/ELC
4833 */
4834
4835 //undefs at "_undefs.hpp"
4836
4837 //set ELC_WARNING_LEVEL default to 4(max)
4838 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
4839
4840 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
4841 //basic_environment.hpp
4842 /*
4843 未完成的elc解释器_share文件
4844 由steve02081504与Alex0125设计、编写
4845 转载时请在不对此文件做任何修改的同时注明出处
4846 项目地址:https://github.com/steve02081504/ELC
4847 */
4848
4849 //每个bit(不是字节)的可能性
4850 //为什么c艹委员会不定义这个?
4851 #define BIT_POSSIBILITY 2
4852
4853 //file_end
4854
4855 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
4856
4857 #if defined(_MSC_VER)
4858 #pragma warning(push,ELC_WARNING_LEVEL)
4859 #pragma warning(disable:4099)//class与struct混用警告diss
4860 #pragma warning(disable:26812)//enum class安利diss.
4861 #pragma warning(disable:4584)//重复子类警告diss
4862 #pragma warning(disable:4250)//域控制继承警告diss
4863 #pragma warning(disable:26432)//不完全默认方法警告diss
4864 #pragma warning(disable:26435)//virtual override方法警告diss
4865 #pragma warning(disable:26481)//容器安利diss
4866 #pragma warning(disable:26446)//gsl::at安利diss
4867 #pragma warning(disable:26434)//方法覆盖警告diss
4868 #pragma warning(disable:26429)//gsl::not_null安利diss
4869 #pragma warning(disable:26471)//对void*进行static_cast安利diss
4870 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
4871 #pragma warning(disable:26473)//相同指针显式cast警告diss
4872 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
4873 #pragma warning(disable:26485)//数组作指针警告diss
4874 #pragma warning(disable:26490)//reinterpret_cast警告diss
4875 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
4876 #pragma warning(disable:26482)//非常数数组索引警告diss
4877 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
4878 #endif
4879 #if defined(_MSC_VER)
4880 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
4881 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
4882 #define push_msvc_warning() __pragma(warning(push))
4883 #define pop_msvc_warning() __pragma(warning(pop))
4884 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
4885 #else
4886 #define suppress_msvc_warning(...)
4887 #define disable_msvc_warning(...)
4888 #define push_msvc_warning()
4889 #define pop_msvc_warning()
4890 #define push_and_disable_msvc_warning(...)
4891 #endif
4892 //
4893 #if defined(ELC_VOID_NAME)
4894 #undef void
4895 #endif
4896
4897 // #define often_noexcept
4898 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
4899 #define noexcept_as_auto MAGIC//哦现在有了
4900 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
4901 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
4902
4903 #define using_method_from_base_t(name,...) \
4904 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
4905 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
4906 {\
4907 return base_t::name(forward<Args>(rest)...);\
4908 }\
4909
4910 #define using_method_from_value(name,value_name,...) \
4911 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
4912 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
4913 {\
4914 return value_name.name(forward<Args>(rest)...);\
4915 }\
4916
4917 #define floop while(__builtin_is_my_dick_still_there())
4918 #define enable_adl(name) void name()noexcept=delete
4919
4920 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
4921 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
4922
4923 #define declvalue(...) (::std::declval<__VA_ARGS__>())
4924
4925 /*实例化到此将引发错误*/
4926 #define template_error(reason) static_assert(template_error_helper<T>,reason)
4927 /*实例化到此将引发警告*/
4928 #define template_warning(reason) template_warning_helper<T>(reason)
4929
4930 //for type_info
4931 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
4932 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
4933
4934 #define is_common_attribute(name) public attribute<T,name<T>>
4935 #define is_special_attribute(name) public attribute<T,name>
4936
4937 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
4938 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
4939
4940 //for float_size_t
4941 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
4942 //bitnum_of
4943 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
4944
4945 //for attribute
4946 #define def_common_attribute_with_nothing(name) \
4947 template<typename T>\
4948 class name{}\
4949
4950 #define def_special_attribute_with_nothing(name) \
4951 class name{}\
4952
4953 #define common_attribute_t template<class>class
4954 #define special_attribute_t class
4955
4956 /*
4957 若参数的布尔值为零,那么此模板不会实例化
4958
4959 为什么不用cpp20的constraints?
4960 1.不能类内定义
4961 2.不能作为模板参数
4962 一句话总结:c艹标准会sb
4963 */
4964 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
4965 /*默认参与模板候选*/
4966 #define enabled_by_default class enable_state=void
4967 /*默认不参与模板候选*/
4968 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
4969 /*若参数为病式,那么此模板不会实例化*/
4970 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
4971 /*用于模板声明*/
4972 #define enable_flag class enable_state
4973
4974 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
4975 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
4976 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
4977 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
4978 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
4979
4980 /*让lambda递归更加美观*/
4981 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
4982 /*让lambda递归更加美观*/
4983 #define get_recursive_lambda_caller(name) \
4984 lambda_with_catch(&)(auto&&...Args){\
4985 return name(name,Args...);\
4986 }
4987 /*让lambda定义更加美观*/
4988 #define lambda []
4989 /*让lambda定义更加美观*/
4990 #define lambda_with_catch(...) [__VA_ARGS__]
4991 /*让lambda递归更加美观*/
4992 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
4993 //recursive_lambda_self_referential_reserved_symbolname
4994 #define lambda_RLSRRS _my_jb_super_sb_name_
4995
4996 #define MAGIC//ahh,ko no tenno da!
4997
4998 /*装饰性语法糖*/
4999 #define nothing
5000
5001 /*aya风格语法糖*/
5002 #define elseif else if
5003 /*aya风格语法糖*/
5004 #define _big_than_ >
5005 /*aya风格语法糖*/
5006 #define _small_than_ <
5007
5008 #if defined(_MSC_VER)
5009 #define not !
5010 #define and &&
5011 #define or ||
5012 #endif
5013
5014 /*进入名称空间,并不是很美观*/
5015 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
5016 /*退出名称空间,并不是很美观*/
5017 #define BREAK_NAMESPACE }
5018
5019 /*template说明符*/
5020 #define template_name template
5021 /*template说明符*/
5022 #define type_name class
5023
5024 #if defined(DEBUG) || defined(_DEBUG)
5025 #define not_in_debug 0
5026 #else
5027 #define not_in_debug 1
5028 #endif
5029
5030 #define es U""
5031 #define ec(ch) U ## ch
5032
5033 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
5034 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
5035 #else
5036 #define ELC_TEST_EVENTNAME(name)
5037 #endif
5038
5039 #define override_instance_struct \
5040 protected:\
5041 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
5042 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
5043 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
5044 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
5045 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
5046
5047 #if defined(_WIN32)
5048 #define distinctive __declspec(dllexport)
5049 #else
5050 #define distinctive
5051 #endif
5052
5053 #if defined(_WIN32)
5054 #define force_inline __forceinline
5055 #elif defined(__GNUC__)
5056 #define force_inline __attribute__((always_inline)) inline
5057 #else
5058 #define force_inline inline
5059 #endif
5060
5061 #if defined(_WIN32)
5062 #define with_no_vtable __declspec(novtable)
5063 #else
5064 #define with_no_vtable
5065 #endif
5066
5067 #define in_consteval (::std::is_constant_evaluated())
5068
5069 #define no_vtable_struct struct with_no_vtable
5070 #define no_vtable_class class with_no_vtable
5071
5072 //file_end
5073
5074 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
5075 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/zh_cn.hpp"
5076 //zh_cn.hpp
5077 /*
5078 未完成的elc解释器_share文件
5079 由steve02081504与Alex0125设计、编写
5080 转载时请在不对此文件做任何修改的同时注明出处
5081 项目地址:https://github.com/steve02081504/ELC
5082 */
5083 /*
5084 locale说明
5085 elc使用的字符串.
5086 调整这些,实现快速本地化.
5087 */
5088 namespace elc::defs::locale::func{
5089
5090 }
5091 namespace elc::defs::locale::str{
5092 inline namespace gc{
5093 inline constexpr auto gc_fail=es"gc失败"_constexpr_str;
5094 inline constexpr auto empty_gc_method=es"gc方法为空时gc被调用"_constexpr_str;
5095 }
5096 inline namespace code_convert{
5097 inline constexpr auto setlocale_error=es"setlocale出错"_constexpr_str;
5098 inline constexpr auto code_convert_error=es"编码转换出错"_constexpr_str;
5099 }
5100 inline namespace lib_load{
5101 inline constexpr auto null_lib=es"访问null处的lib对象"_constexpr_str;
5102 }
5103 inline namespace exception{
5104 inline constexpr auto unknow_error=es"未知错误"_constexpr_str;
5105 inline constexpr auto core_runtime_internal_helper_leak=es"未知错误"_constexpr_str;
5106 }
5107 inline namespace base_read{
5108 inline constexpr auto ending_of_expr_beyond_expectations=es"表达式的结尾超出预期"_constexpr_str;
5109 inline constexpr auto expr_incomplete=es"表达式未完成"_constexpr_str;
5110 inline constexpr auto symbol_is_undefined=es"此符号未定义"_constexpr_str;
5111 inline constexpr auto expr_too_outrageous=es"表达式过于离谱"_constexpr_str;
5112 }
5113 inline namespace package_symbol_loader{
5114 inline constexpr auto load_failed=es"无法加载的package_symbol_loader"_constexpr_str;
5115 inline constexpr auto load_interface_failed=es"package_symbol_loader缺失load_interface"_constexpr_str;
5116 }
5117 }
5118
5119 //file_end
5120
5121 #line 23 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
5122 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
5123 //_undefs.hpp
5124 /*
5125 未完成的elc解释器_share文件
5126 由steve02081504与Alex0125设计、编写
5127 转载时请在不对此文件做任何修改的同时注明出处
5128 项目地址:https://github.com/steve02081504/ELC
5129 */
5130
5131 //defs at "_defs.hpp"
5132
5133 #if defined(_MSC_VER)
5134 #pragma warning(pop)
5135 #endif
5136 #undef suppress_msvc_warning
5137 #undef disable_msvc_warning
5138 #undef push_msvc_warning
5139 #undef pop_msvc_warning
5140 #undef push_and_disable_msvc_warning
5141
5142 //for basic_environment.hpp
5143 #undef BIT_POSSIBILITY
5144 //
5145 #if defined(ELC_VOID_NAME)
5146 #define void the_void
5147 #endif
5148
5149 // #undef often_noexcept
5150 #undef noexcept_as
5151 #undef noexcept_as_auto
5152 #undef constexpr_as
5153 #undef constexpr_as_auto
5154
5155 #undef using_method_from_base_t
5156 #undef using_method_from_value
5157
5158 #undef floop
5159 #undef enable_adl
5160
5161 #undef re_declvalue
5162 #undef re_decltype
5163
5164 #undef declvalue
5165
5166 #undef template_error
5167 #undef template_warning
5168
5169 #undef type_info_of
5170 #undef type_name_of
5171
5172 #undef is_common_attribute
5173 #undef is_special_attribute
5174
5175 #undef has_attribute
5176 #undef not_has_attribute
5177
5178 #undef float_size_of
5179 #undef bitnum_of
5180
5181 #undef def_common_attribute_with_nothing
5182 #undef def_special_attribute_with_nothing
5183
5184 #undef common_attribute_t
5185 #undef special_attribute_t
5186
5187 #undef enable_if
5188 #undef enabled_by_default
5189 #undef disabled_by_default
5190 #undef enable_if_not_ill_form
5191 #undef enable_flag
5192
5193 #undef was_an_ill_form
5194 #undef was_an_ill_form_with_parameter
5195 #undef was_not_an_ill_form
5196 #undef was_not_an_ill_form_and_noexcept
5197 #undef was_not_an_ill_form_with_parameter
5198
5199 #undef recursive_lambda
5200 #undef get_recursive_lambda_caller
5201 #undef lambda
5202 #undef lambda_with_catch
5203 #undef self_recursion
5204 #undef lambda_RLSRRS
5205
5206 #undef MAGIC
5207
5208 #undef nothing
5209
5210 #undef elseif
5211 #undef _big_than_
5212 #undef _small_than_
5213
5214 #if defined(_MSC_VER)
5215 #undef not
5216 #undef and
5217 #undef or
5218 #endif
5219
5220 #undef INTER_NAMESPACE
5221 #undef BREAK_NAMESPACE
5222
5223 #undef szie
5224 #undef form
5225
5226 #undef template_name
5227 #undef type_name
5228
5229 #undef not_in_debug
5230
5231 #undef es
5232 #undef ec
5233
5234 #undef ELC_TEST_EVENTNAME
5235
5236 #undef override_instance_struct
5237
5238 #undef distinctive
5239
5240 #undef force_inline
5241
5242 #undef with_no_vtable
5243
5244 #undef in_consteval
5245
5246 #undef no_vtable_struct
5247 #undef no_vtable_class
5248
5249 //file_end
5250
5251 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
5252 //
5253 #endif
5254
5255 //file_end
5256
5257 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
5258
5259 namespace elc::defs{ //在elc::defs中定义内容
5260 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
5261 //_defs.hpp
5262 /*
5263 未完成的elc解释器basic文件
5264 由steve02081504与Alex0125设计、编写
5265 转载时请在不对此文件做任何修改的同时注明出处
5266 项目地址:https://github.com/steve02081504/ELC
5267 */
5268 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
5269 //_defs.hpp
5270 /*
5271 未完成的elc解释器_share文件
5272 由steve02081504与Alex0125设计、编写
5273 转载时请在不对此文件做任何修改的同时注明出处
5274 项目地址:https://github.com/steve02081504/ELC
5275 */
5276
5277 //undefs at "_undefs.hpp"
5278
5279 //set ELC_WARNING_LEVEL default to 4(max)
5280 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
5281
5282 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
5283 //basic_environment.hpp
5284 /*
5285 未完成的elc解释器_share文件
5286 由steve02081504与Alex0125设计、编写
5287 转载时请在不对此文件做任何修改的同时注明出处
5288 项目地址:https://github.com/steve02081504/ELC
5289 */
5290
5291 //每个bit(不是字节)的可能性
5292 //为什么c艹委员会不定义这个?
5293 #define BIT_POSSIBILITY 2
5294
5295 //file_end
5296
5297 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
5298
5299 #if defined(_MSC_VER)
5300 #pragma warning(push,ELC_WARNING_LEVEL)
5301 #pragma warning(disable:4099)//class与struct混用警告diss
5302 #pragma warning(disable:26812)//enum class安利diss.
5303 #pragma warning(disable:4584)//重复子类警告diss
5304 #pragma warning(disable:4250)//域控制继承警告diss
5305 #pragma warning(disable:26432)//不完全默认方法警告diss
5306 #pragma warning(disable:26435)//virtual override方法警告diss
5307 #pragma warning(disable:26481)//容器安利diss
5308 #pragma warning(disable:26446)//gsl::at安利diss
5309 #pragma warning(disable:26434)//方法覆盖警告diss
5310 #pragma warning(disable:26429)//gsl::not_null安利diss
5311 #pragma warning(disable:26471)//对void*进行static_cast安利diss
5312 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
5313 #pragma warning(disable:26473)//相同指针显式cast警告diss
5314 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
5315 #pragma warning(disable:26485)//数组作指针警告diss
5316 #pragma warning(disable:26490)//reinterpret_cast警告diss
5317 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
5318 #pragma warning(disable:26482)//非常数数组索引警告diss
5319 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
5320 #endif
5321 #if defined(_MSC_VER)
5322 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
5323 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
5324 #define push_msvc_warning() __pragma(warning(push))
5325 #define pop_msvc_warning() __pragma(warning(pop))
5326 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
5327 #else
5328 #define suppress_msvc_warning(...)
5329 #define disable_msvc_warning(...)
5330 #define push_msvc_warning()
5331 #define pop_msvc_warning()
5332 #define push_and_disable_msvc_warning(...)
5333 #endif
5334 //
5335 #if defined(ELC_VOID_NAME)
5336 #undef void
5337 #endif
5338
5339 // #define often_noexcept
5340 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
5341 #define noexcept_as_auto MAGIC//哦现在有了
5342 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
5343 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
5344
5345 #define using_method_from_base_t(name,...) \
5346 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
5347 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
5348 {\
5349 return base_t::name(forward<Args>(rest)...);\
5350 }\
5351
5352 #define using_method_from_value(name,value_name,...) \
5353 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
5354 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
5355 {\
5356 return value_name.name(forward<Args>(rest)...);\
5357 }\
5358
5359 #define floop while(__builtin_is_my_dick_still_there())
5360 #define enable_adl(name) void name()noexcept=delete
5361
5362 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
5363 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
5364
5365 #define declvalue(...) (::std::declval<__VA_ARGS__>())
5366
5367 /*实例化到此将引发错误*/
5368 #define template_error(reason) static_assert(template_error_helper<T>,reason)
5369 /*实例化到此将引发警告*/
5370 #define template_warning(reason) template_warning_helper<T>(reason)
5371
5372 //for type_info
5373 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
5374 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
5375
5376 #define is_common_attribute(name) public attribute<T,name<T>>
5377 #define is_special_attribute(name) public attribute<T,name>
5378
5379 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
5380 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
5381
5382 //for float_size_t
5383 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
5384 //bitnum_of
5385 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
5386
5387 //for attribute
5388 #define def_common_attribute_with_nothing(name) \
5389 template<typename T>\
5390 class name{}\
5391
5392 #define def_special_attribute_with_nothing(name) \
5393 class name{}\
5394
5395 #define common_attribute_t template<class>class
5396 #define special_attribute_t class
5397
5398 /*
5399 若参数的布尔值为零,那么此模板不会实例化
5400
5401 为什么不用cpp20的constraints?
5402 1.不能类内定义
5403 2.不能作为模板参数
5404 一句话总结:c艹标准会sb
5405 */
5406 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
5407 /*默认参与模板候选*/
5408 #define enabled_by_default class enable_state=void
5409 /*默认不参与模板候选*/
5410 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
5411 /*若参数为病式,那么此模板不会实例化*/
5412 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
5413 /*用于模板声明*/
5414 #define enable_flag class enable_state
5415
5416 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
5417 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
5418 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
5419 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
5420 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
5421
5422 /*让lambda递归更加美观*/
5423 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
5424 /*让lambda递归更加美观*/
5425 #define get_recursive_lambda_caller(name) \
5426 lambda_with_catch(&)(auto&&...Args){\
5427 return name(name,Args...);\
5428 }
5429 /*让lambda定义更加美观*/
5430 #define lambda []
5431 /*让lambda定义更加美观*/
5432 #define lambda_with_catch(...) [__VA_ARGS__]
5433 /*让lambda递归更加美观*/
5434 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
5435 //recursive_lambda_self_referential_reserved_symbolname
5436 #define lambda_RLSRRS _my_jb_super_sb_name_
5437
5438 #define MAGIC//ahh,ko no tenno da!
5439
5440 /*装饰性语法糖*/
5441 #define nothing
5442
5443 /*aya风格语法糖*/
5444 #define elseif else if
5445 /*aya风格语法糖*/
5446 #define _big_than_ >
5447 /*aya风格语法糖*/
5448 #define _small_than_ <
5449
5450 #if defined(_MSC_VER)
5451 #define not !
5452 #define and &&
5453 #define or ||
5454 #endif
5455
5456 /*进入名称空间,并不是很美观*/
5457 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
5458 /*退出名称空间,并不是很美观*/
5459 #define BREAK_NAMESPACE }
5460
5461 /*template说明符*/
5462 #define template_name template
5463 /*template说明符*/
5464 #define type_name class
5465
5466 #if defined(DEBUG) || defined(_DEBUG)
5467 #define not_in_debug 0
5468 #else
5469 #define not_in_debug 1
5470 #endif
5471
5472 #define es U""
5473 #define ec(ch) U ## ch
5474
5475 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
5476 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
5477 #else
5478 #define ELC_TEST_EVENTNAME(name)
5479 #endif
5480
5481 #define override_instance_struct \
5482 protected:\
5483 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
5484 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
5485 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
5486 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
5487 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
5488
5489 #if defined(_WIN32)
5490 #define distinctive __declspec(dllexport)
5491 #else
5492 #define distinctive
5493 #endif
5494
5495 #if defined(_WIN32)
5496 #define force_inline __forceinline
5497 #elif defined(__GNUC__)
5498 #define force_inline __attribute__((always_inline)) inline
5499 #else
5500 #define force_inline inline
5501 #endif
5502
5503 #if defined(_WIN32)
5504 #define with_no_vtable __declspec(novtable)
5505 #else
5506 #define with_no_vtable
5507 #endif
5508
5509 #define in_consteval (::std::is_constant_evaluated())
5510
5511 #define no_vtable_struct struct with_no_vtable
5512 #define no_vtable_class class with_no_vtable
5513
5514 //file_end
5515
5516 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
5517
5518 //file_end
5519
5520 #line 20 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
5521
5522 namespace memory{
5523 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/lifetime/_body.hpp"
5524 //_body.hpp
5525 //at namespace elc::defs::memory
5526 /*
5527 未完成的elc解释器base文件
5528 由steve02081504与Alex0125设计、编写
5529 转载时请在不对此文件做任何修改的同时注明出处
5530 项目地址:https://github.com/steve02081504/ELC
5531 */
5532 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/lifetime/defs.hpp"
5533 //defs.hpp
5534 //at namespace elc::defs::memory
5535 /*
5536 未完成的elc解释器base文件
5537 由steve02081504与Alex0125设计、编写
5538 转载时请在不对此文件做任何修改的同时注明出处
5539 项目地址:https://github.com/steve02081504/ELC
5540 */
5541 namespace lifetime_n{
5542 class copy_t;
5543
5544 class move_t;
5545 //
5546
5547 template<class T>
5548 class construct_t;
5549 template<class T,class...Args>
5550 constexpr bool construct_able=::std::is_constructible_v<T,Args...>;
5551 template<class T,class...Args>
5552 constexpr bool construct_nothrow=::std::is_nothrow_constructible_v<T,Args...>;
5553 template<class T,class...Args>
5554 constexpr bool construct_trivial=::std::is_trivially_constructible_v<T,Args...>;
5555
5556 class destruct_t;
5557 template<class T>
5558 constexpr bool destruct_able=::std::is_destructible_v<T>;
5559 template<class T>
5560 constexpr bool destruct_nothrow=::std::is_nothrow_destructible_v<T>;
5561 template<class T>
5562 constexpr bool destruct_trivial=::std::is_trivially_destructible_v<T>;
5563 //
5564
5565 class copy_construct_t;
5566 template<class T>
5567 constexpr bool copy_construct_able=::std::is_copy_constructible_v<T>;
5568 template<class T>
5569 constexpr bool copy_construct_nothrow=::std::is_nothrow_copy_constructible_v<T>;
5570 template<class T>
5571 constexpr bool copy_construct_trivial=::std::is_trivially_copy_constructible_v<T>;
5572
5573 class move_construct_t;
5574 template<class T>
5575 constexpr bool move_construct_able=::std::is_move_constructible_v<T>;
5576 template<class T>
5577 constexpr bool move_construct_nothrow=::std::is_nothrow_move_constructible_v<T>;
5578 template<class T>
5579 constexpr bool move_construct_trivial=::std::is_trivially_move_constructible_v<T>;
5580 //
5581
5582 class copy_assign_t;
5583 template<class T>
5584 constexpr bool copy_assign_able=::std::is_copy_assignable_v<T>;
5585 template<class T>
5586 constexpr bool copy_assign_nothrow=::std::is_nothrow_copy_assignable_v<T>;
5587 template<class T>
5588 constexpr bool copy_assign_trivial=::std::is_trivially_copy_assignable_v<T>;
5589
5590 class move_assign_t;
5591 template<class T>
5592 constexpr bool move_assign_able=::std::is_move_assignable_v<T>;
5593 template<class T>
5594 constexpr bool move_assign_nothrow=::std::is_nothrow_move_assignable_v<T>;
5595 template<class T>
5596 constexpr bool move_assign_trivial=::std::is_trivially_move_assignable_v<T>;
5597 //
5598
5599 template<class T> requires(::std::is_trivially_copyable_v<T>)
5600 force_inline T* super_speed_trivial_copy_from_one(T*to,const T&value,size_t size)noexcept{
5601 if constexpr(sizeof(T)==sizeof(unsigned char))
5602 ::std::memset((unsigned char*)to,(unsigned char)value,size);
5603 elseif constexpr(sizeof(T)==sizeof(wchar_t))
5604 ::std::wmemset((wchar_t*)to,(wchar_t)value,size);
5605 else
5606 if(is_all_byte_zero(value))
5607 ::std::memset(to,zero,size*sizeof(T));
5608 else
5609 ::std::fill_n(to,size,value);
5610 return to;
5611 }
5612 template<class T> requires(::std::is_trivially_copyable_v<T>)
5613 force_inline T* super_speed_trivial_copy_from_one(T*to,const T&value)noexcept{
5614 if constexpr(sizeof(T)>=sizeof(::std::max_align_t))
5615 if(is_all_byte_zero(value))
5616 ::std::memset(to,zero,sizeof(T));
5617 else
5618 *to=value;
5619 else
5620 *to=value;
5621 return to;
5622 }
5623
5624 /*
5625 lifetime_n的一部分
5626 所有的construct_t实例都派生于此
5627 */
5629 /*
5630 lifetime_n的一部分
5631 用于构造实例
5632 用法详见变量模板construct
5633 */
5634 template<typename T>
5636 typedef base_construct_t base_t;
5637 template<class...Args>
5638 static constexpr bool able=construct_able<T,Args...>;
5639 template<class...Args>
5640 static constexpr bool nothrow=construct_nothrow<T,Args...>;
5641 template<class...Args>
5642 static constexpr bool trivial=construct_trivial<T,Args...>;
5643
5644 template<class...Args> requires able<Args...>
5645 [[nodiscard]]force_inline T operator()(Args&&...rest)const noexcept(nothrow<Args...>){
5646 return T(forward<Args>(rest)...);
5647 }
5649 T*_to;
5650 size_t _size;
5651 constexpr void never_in_array_check()const noexcept{
5652 if constexpr(type_info<T>.has_attribute(never_in_array))
5653 template_error("You can\'t construct an array for never_in_array type.");
5654 }
5655 template<class...Args> requires able<Args...>
5656 force_inline void base_call(Args&&...rest)const noexcept(nothrow<Args...>){
5657 auto tmp=_size;
5658 while(tmp--)new(_to+tmp)T(forward<Args>(rest)...);
5659 }
5660 template<class...Args> requires able<Args...>
5661 force_inline T* operator()(Args&&...rest)const noexcept(nothrow<Args...>){
5662 never_in_array_check();
5663 base_call(forward<Args>(rest)...);
5664 return _to;
5665 }
5666 //复制构造速度优化
5667 force_inline T* operator()(const T&v)const noexcept(nothrow<const T&>)requires able<const T&>{
5668 never_in_array_check();
5669 if constexpr(trivial<const T&> && ::std::is_trivially_copyable_v<T>)
5670 super_speed_trivial_copy_from_one(_to,v,_size);
5671 else
5672 base_call(forward<const T&>(v));
5673 return _to;
5674 }
5675 //默认构造逻辑优化
5676 force_inline T* operator()()const noexcept(nothrow<>)requires able<>{
5677 never_in_array_check();
5678 if constexpr(!trivial<>)
5679 base_call();
5680 return _to;
5681 }
5682 };
5684 T*_to;
5685 template<class...Args> requires able<Args...>
5686 force_inline void base_call(Args&&...rest)const noexcept(nothrow<Args...>){
5687 new(_to)T(forward<Args>(rest)...);
5688 }
5689 template<class...Args> requires able<Args...>
5690 force_inline T* operator()(Args&&...rest)const noexcept(nothrow<Args...>){
5691 base_call(forward<Args>(rest)...);
5692 return _to;
5693 }
5694 //复制构造速度优化
5695 force_inline T* operator()(const T&v)const noexcept(nothrow<const T&>)requires able<const T&>{
5696 if constexpr(trivial<const T&> && ::std::is_trivially_copyable_v<T>)
5697 super_speed_trivial_copy_from_one(_to,v);
5698 else
5699 base_call(forward<const T&>(v));
5700 return _to;
5701 }
5702 //默认构造逻辑优化
5703 force_inline T* operator()()const noexcept(nothrow<>)requires able<>{
5704 if constexpr(!trivial<>)
5705 base_call();
5706 return _to;
5707 }
5708 [[nodiscard]]force_inline constexpr array_construct_t operator[](size_t size)const noexcept{return{_to,size};}
5709 };
5710 [[nodiscard]]force_inline constexpr placement_construct_t operator[](T*p)const noexcept{return{p};}
5711 };
5712 /*
5713 lifetime_n的一部分
5714 constexpr变量模板,用于构造实例
5715 用法:
5716 construct<类型>.able<构造参数类型> -> bool
5717 construct<类型>.nothrow<构造参数类型> -> bool
5718 construct<T>(参数) -> T (以参数构建T类型实例)
5719
5720 construct<T>[T*ptr](参数) -> T* (以参数在ptr地址处构建T类型实例,返回ptr)
5721 construct<T>[T*ptr][size_t size](参数) -> T* (以参数在ptr地址处构建size个T类型实例,返回ptr)
5722 */
5723 template<typename T>
5724 constexpr construct_t<T>construct{};
5725
5726 /*
5727 lifetime_n的一部分
5728 用于销毁实例
5729 用法:
5730 destruct.able<类型> -> bool
5731 destruct.nothrow<类型> -> bool
5732
5733 destruct(T*ptr) -> void (在ptr地址处析构T类型实例,T可为数组)
5734 destruct[size_t size](T*ptr) -> void (析构以ptr地址起始共size个T类型实例,T可为数组)
5735 */
5736 constexpr struct destruct_t{
5737 template<class T>
5738 static constexpr bool able=destruct_able<T>||(::std::is_array_v<T>&&able<::std::remove_extent_t<T>>);
5739 template<class T>
5740 static constexpr bool nothrow=destruct_nothrow<T>||(::std::is_array_v<T>&&nothrow<::std::remove_extent_t<T>>);
5741 template<class T>
5742 static constexpr bool trivial=destruct_trivial<T>||(::std::is_array_v<T>&&trivial<::std::remove_extent_t<T>>);
5743
5744 template<class T> requires able<T>
5745 static force_inline void base_call(T*to)noexcept(nothrow<T>){
5746 if constexpr(!trivial<T>)
5747 if constexpr(::std::is_array_v<T>)
5748 for(auto&i : *to)
5749 base_call(addressof(i));
5750 else
5751 suppress_msvc_warning(26457)//虽然我不是很理解为啥调用析构函数会触发这个
5752 to->~T();
5753 }
5754
5755 template<class T> requires able<T>
5756 static void base_call([[maybe_unused]]T*begin,[[maybe_unused]]size_t size)noexcept(nothrow<T>){
5757 if constexpr(type_info<T>.has_attribute(never_in_array))
5758 template_error("You cannot perform array operations on never_in_array type.");
5759 if constexpr(!trivial<T>)
5760 while(size--)base_call(begin+size);
5761 }
5762
5763 template<class T> requires able<T>
5764 force_inline void operator()(T*begin)const noexcept(nothrow<T>){
5765 base_call(begin);
5766 }
5767
5769 size_t _size;
5770 template<class T> requires able<T>
5771 force_inline void operator()(T*begin)const noexcept(nothrow<T>){
5772 base_call(begin,_size);
5773 }
5774 };
5775
5776 [[nodiscard]]force_inline constexpr array_destruct_t operator[](size_t size)const noexcept{return{size};}
5777
5778 struct not_t{};
5779 /*适用于unget(this,not destruct);*/
5780 force_inline constexpr not_t operator!()const noexcept{return not_t{};}
5781 }destruct{};
5782
5783 /*
5784 lifetime_n的一部分
5785 用于重新构造实例:先摧毁,再原地构建
5786 用法:
5787 re_construct.able<类型> -> bool
5788 re_construct.nothrow<类型> -> bool
5789
5790 re_construct(T*ptr) -> T* (以无参数在ptr地址处重新构建T类型实例,返回ptr)
5791 re_construct[T*ptr](参数) -> T* (以参数在ptr地址处重新构建T类型实例,返回ptr)
5792 re_construct[T*ptr][size_t size](参数) -> T* (以参数在ptr地址处重新构建size个T类型实例,返回ptr)
5793 常见用法:
5794 re_construct(this)
5795 */
5796 constexpr struct re_construct_t{
5797 template<class T,class...Args>
5798 static constexpr bool able=destruct.able<T>&&construct<T>.able<Args...>;
5799 template<class T,class...Args>
5800 static constexpr bool nothrow=destruct.nothrow<T>&&construct<T>.nothrow<Args...>;
5801 template<class T,class...Args>
5802 static constexpr bool trivial=destruct.trivial<T>&&construct<T>.trivial<Args...>;
5803
5804 template<class T> requires able<T>
5805 force_inline T* operator()(T*to)const noexcept(nothrow<T>){
5806 destruct(to);
5807 construct<T>[to]();
5808 return to;
5809 }
5810 template<class T>
5812 T*_to;
5813 size_t _size;
5814 template<class...Args> requires able<T,Args...>
5815 T* operator()(Args&&...rest)const noexcept(nothrow<T,Args...>){
5816 if constexpr(type_info<T>.has_attribute(never_in_array))
5817 template_error("You cannot perform array operations on never_in_array type.");
5818 destruct[_size](_to);
5819 construct<T>[_to][_size](forward<Args>(rest)...);
5820 return _to;
5821 }
5822 };
5823 template<class T>
5825 T*_to;
5826 template<class...Args> requires able<T,Args...>
5827 T* operator()(Args&&...rest)const noexcept(nothrow<T,Args...>){
5828 destruct(_to);
5829 construct<T>[_to](forward<Args>(rest)...);
5830 return _to;
5831 }
5832 [[nodiscard]]force_inline constexpr array_re_construct_t<T> operator[](size_t size)const noexcept{return{_to,size};}
5833 };
5834 template<class T>
5835 [[nodiscard]]force_inline constexpr placement_re_construct_t<T> operator[](T*p)const noexcept{return{p};}
5836 }re_construct;
5837
5838 constexpr struct copy_construct_t{
5839 template<class T>
5840 static constexpr bool r_able=copy_construct_able<T>?
5841 copy_construct_trivial<T>||!(construct<T>.trivial<>&&copy_assign_trivial<T>)
5842 :false;//trivial操作优先考虑
5843 template<class T>
5844 static constexpr bool able=r_able<T>?true:(construct<T>.able<>&&copy_assign_able<T>);
5845 template<class T>
5846 static constexpr bool nothrow=r_able<T>?copy_construct_nothrow<T>:
5847 (construct<T>.nothrow<>&&copy_assign_nothrow<T>);
5848 template<class T>
5849 static constexpr bool trivial=r_able<T>?copy_construct_trivial<T>:
5850 (construct<T>.trivial<>&&copy_assign_trivial<T>);
5851
5852 template<class T> requires able<T>
5853 static T*base_call(T*to,const T*from)noexcept(nothrow<T>){
5854 if constexpr(trivial<T>)
5855 return reinterpret_cast<T*>(::std::memcpy(to,add_const(from),sizeof(T)));
5856 else{
5857 if constexpr(r_able<T>)
5858 new(to)T(*from);
5859 else{
5860 construct<T>[to]();
5861 *to=*from;
5862 }
5863 return to;
5864 }
5865 }
5866
5867 template<class T> requires able<T>
5868 static T*base_call(T*to,const T*from,size_t size)noexcept(nothrow<T>){
5869 if constexpr(trivial<T>)
5870 return reinterpret_cast<T*>(::std::memcpy(to,add_const(from),sizeof(T)*size));
5871 else{
5872 while(size--)
5873 base_call(to+size,from+size);
5874 return to;
5875 }
5876 }
5877
5878 template<class T> requires able<T>
5879 force_inline T*operator()(T*to,const T*from)const noexcept(nothrow<T>)
5880 {return base_call(to,from);}
5881
5882 template<class T> requires able<T>
5883 force_inline T*operator()(note::to_t<T*>to,note::from_t<const T*>from)const noexcept(nothrow<T>)
5884 {return base_call(to(),from());}
5885
5886 template<class T> requires able<T>
5887 force_inline T*operator()(note::from_t<const T*>from,note::to_t<T*>to)const noexcept(nothrow<T>)
5888 {return base_call(to(),from());}
5889
5890
5891 template<class T> requires able<T>
5892 force_inline T*operator()(T*to,const T*from,size_t size)const noexcept(nothrow<T>)
5893 {return base_call(to,from,size);}
5894
5895 template<class T> requires able<T>
5896 force_inline T*operator()(note::to_t<T*>to,note::from_t<const T*>from,size_t size)const noexcept(nothrow<T>)
5897 {return base_call(to(),from(),size);}
5898
5899 template<class T> requires able<T>
5900 force_inline T*operator()(note::from_t<const T*>from,note::to_t<T*>to,size_t size)const noexcept(nothrow<T>)
5901 {return base_call(to(),from(),size);}
5902
5903 template<class T> requires able<T>
5904 static T*base_call(T*to,const T&from)noexcept(nothrow<T>){
5905 if constexpr(r_able<T>)
5906 construct<T>[to](from);
5907 else{
5908 construct<T>[to]();
5909 *to=from;
5910 }
5911 return to;
5912 }
5913
5914 template<class T> requires able<T>
5915 static T*base_call(T*to,const T&from,size_t size)noexcept(nothrow<T>){
5916 if constexpr(type_info<T>.has_attribute(never_in_array))
5917 template_error("You cannot perform array operations on never_in_array type.");
5918 if constexpr(::std::is_trivially_copyable_v<T>)
5919 super_speed_trivial_copy_from_one(to,from,size);
5920 else
5921 while(size--)
5922 base_call(to+size,from);
5923 return to;
5924 }
5925
5926 template<class T> requires able<T>
5927 force_inline T*operator()(T*to,const T&from)const noexcept(nothrow<T>)
5928 {return base_call(to,from);}
5929
5931 size_t _size;
5932 template<class T> requires able<T>
5933 force_inline T*operator()(T*to,const T*from)const noexcept(nothrow<T>){
5934 return base_call(to,from,_size);
5935 }
5936 template<class T> requires able<T>
5937 force_inline T*operator()(T*to,const T&from)const noexcept(nothrow<T>){
5938 return base_call(to,from,_size);
5939 }
5940 template<class T> requires able<T>
5941 force_inline T*operator()(note::to_t<T*>to,note::from_t<const T*>from)const noexcept(nothrow<T>){
5942 return operator()(to(),from());
5943 }
5944 template<class T> requires able<T>
5945 force_inline T*operator()(note::from_t<const T*>from,note::to_t<T*>to)const noexcept(nothrow<T>){
5946 return operator()(to(),from());
5947 }
5948 };
5949 [[nodiscard]]force_inline constexpr array_copy_construct_t operator[](size_t a)const noexcept{return{a};}
5950 }copy_construct{};
5951
5952 constexpr struct move_construct_t{
5953 template<class T>
5954 static constexpr bool r_able=move_construct_able<T>?
5955 move_construct_trivial<T>||!copy_construct.trivial<T>
5956 :false;//trivial操作优先考虑
5957 template<class T>
5958 static constexpr bool able=r_able<T>?true:copy_construct.able<T>;
5959 template<class T>
5960 static constexpr bool nothrow=r_able<T>?move_construct_nothrow<T>:
5961 copy_construct.nothrow<T>;
5962 template<class T>
5963 static constexpr bool trivial=r_able<T>?move_construct_trivial<T>:
5964 copy_construct.trivial<T>;
5965
5966 template<class T> requires able<T>
5967 static T*base_call(T*to,T*from)noexcept(nothrow<T>){
5968 if constexpr(trivial<T>)
5969 return reinterpret_cast<T*>(::std::memcpy(to,add_const(from),sizeof(T)));
5970 else{
5971 if constexpr(r_able<T>){
5972 construct<T>[to](::std::move(*from));
5973 return to;
5974 }else
5975 return copy_construct(to,from);
5976 }
5977 }
5978 template<class T> requires able<T>
5979 static T*base_call(T*to,T*from,size_t size)noexcept(nothrow<T>){
5980 if constexpr(type_info<T>.has_attribute(never_in_array))
5981 template_error("You cannot perform array operations on never_in_array type.");
5982 if constexpr(trivial<T>)
5983 return reinterpret_cast<T*>(::std::memcpy(to,add_const(from),sizeof(T)*size));
5984 else{
5985 if constexpr(r_able<T>){
5986 while(size--)
5987 construct<T>[to+size](::std::move(from[size]));
5988 return to;
5989 }else
5990 return copy_construct[size](to,from);
5991 }
5992 }
5993
5994 template<class T> requires able<T>
5995 force_inline T*operator()(T*to,T*from)const noexcept(nothrow<T>)
5996 {return base_call(to,from);}
5997
5998 template<class T> requires able<T>
5999 force_inline T*operator()(note::to_t<T*>to,note::from_t<T*>from)const noexcept(nothrow<T>)
6000 {return base_call(to(),from());}
6001
6002 template<class T> requires able<T>
6003 force_inline T*operator()(note::from_t<T*>from,note::to_t<T*>to)const noexcept(nothrow<T>)
6004 {return base_call(to(),from());}
6005
6007 size_t _size;
6008 template<class T> requires able<T>
6009 force_inline T*operator()(T*to,T*from)const noexcept(nothrow<T>){
6010 return base_call(to,from,_size);
6011 }
6012 template<class T> requires able<T>
6013 force_inline T*operator()(note::to_t<T*>to,note::from_t<T*>from)const noexcept(nothrow<T>){
6014 return operator()(to(),from());
6015 }
6016 template<class T> requires able<T>
6017 force_inline T*operator()(note::from_t<T*>from,note::to_t<T*>to)const noexcept(nothrow<T>){
6018 return operator()(to(),from());
6019 }
6020 };
6021 [[nodiscard]]force_inline constexpr array_move_construct_t operator[](size_t a)const noexcept{return{a};}
6022 }move_construct{};
6023
6024 constexpr struct move_t{
6025 template<class T>
6026 static constexpr bool able=move_construct.able<T>&&destruct.able<T>;
6027 template<class T>
6028 static constexpr bool nothrow=move_construct.nothrow<T>&&destruct.nothrow<T>;
6029 template<class T>
6030 static constexpr bool trivial=move_construct.trivial<T>&&destruct.trivial<T>;
6031
6032 template<class T> requires able<T>
6033 static T*base_call(T*to,T*from)noexcept(nothrow<T>){
6034 move_construct(to,from);
6035 destruct(from);
6036 return to;
6037 }
6038 template<class T> requires able<T>
6039 static T*base_call(T*to,T*from,size_t size)noexcept(nothrow<T>){
6040 if constexpr(type_info<T>.has_attribute(never_in_array))
6041 template_error("You cannot perform array operations on never_in_array type.");
6042 move_construct[size](to,from);
6043 destruct[size](from);
6044 return to;
6045 }
6046
6047 template<class T> requires able<T>
6048 force_inline T*operator()(T*to,T*from)const noexcept(nothrow<T>)
6049 {return base_call(to,from);}
6050
6051 template<class T> requires able<T>
6052 force_inline T*operator()(note::to_t<T*>to,note::from_t<T*>from)const noexcept(nothrow<T>)
6053 {return base_call(to(),from());}
6054
6055 template<class T> requires able<T>
6056 force_inline T*operator()(note::from_t<T*>from,note::to_t<T*>to)const noexcept(nothrow<T>)
6057 {return base_call(to(),from());}
6058
6060 size_t _size;
6061 template<class T> requires able<T>
6062 force_inline T*operator()(T*to,T*from)const noexcept(nothrow<T>){
6063 return base_call(to,from,_size);
6064 }
6065 template<class T> requires able<T>
6066 force_inline T*operator()(note::to_t<T*>to,note::from_t<T*>from)const noexcept(nothrow<T>){
6067 return operator()(to(),from());
6068 }
6069 template<class T> requires able<T>
6070 force_inline T*operator()(note::from_t<T*>from,note::to_t<T*>to)const noexcept(nothrow<T>){
6071 return operator()(to(),from());
6072 }
6073 };
6074 [[nodiscard]]force_inline constexpr array_move_t operator[](size_t a)const noexcept{return{a};}
6075
6076 //特殊使用
6077 template<class T>
6078 [[nodiscard]]constexpr remove_ref<T>&& operator()(T&&a)const noexcept{
6079 return static_cast<remove_ref<T>&&>(a);
6080 }
6081 }move{};
6082
6083 constexpr struct copy_t{
6084 //特殊使用
6085 //UF
6086 template<class T> requires(copy_construct.able<T>)
6087 [[nodiscard]]constexpr T operator()(const T&a)const noexcept{
6088 return copy_construct<T>(a);
6089 }
6090 }copy{};
6091
6092 constexpr struct copy_assign_t{
6093 template<class T>
6094 static constexpr bool r_able=copy_assign_able<T>?
6095 copy_assign_trivial<T>||!(copy_construct_trivial<T>&&destruct.trivial<T>)
6096 :false;//trivial操作优先考虑
6097 template<class T>
6098 static constexpr bool able=r_able<T>?true:(copy_construct_able<T>&&destruct.able<T>);
6099 template<class T>
6100 static constexpr bool nothrow=r_able<T>?copy_assign_nothrow<T>:
6101 (copy_construct_nothrow<T>&&destruct.nothrow<T>);
6102 template<class T>
6103 static constexpr bool trivial=r_able<T>?copy_assign_trivial<T>:
6104 (copy_construct_trivial<T>&&destruct.trivial<T>);
6105
6106 template<class T> requires able<T>
6107 static T& base_call(T&a,const T&b)noexcept(nothrow<T>){
6108 if constexpr(r_able<T>)
6109 a=b;
6110 else{
6111 destruct(&a);
6112 construct<T>[&a](b);
6113 }
6114 return a;
6115 }
6116 template<class T> requires able<T>
6117 static T* base_call(T*to,const T*from,size_t size)noexcept(nothrow<T>){
6118 if constexpr(trivial<T>)
6119 ::std::memcpy(to,add_const(from),size*sizeof(T));
6120 else{
6121 while(size--)
6122 base_call(to[size],from[size]);
6123 }
6124 return to;
6125 }
6126 template<class T> requires able<T>
6127 static T* base_call(T* to,const T& from,size_t size)noexcept(nothrow<T>){
6128 if constexpr(trivial<T>)
6129 super_speed_trivial_copy_from_one(to,from,size);
6130 else
6131 while(size--)
6132 base_call(to[size],from);
6133 return to;
6134 }
6135
6136 template<class T> requires able<T>
6137 force_inline T& operator()(T&a,const T&b)const noexcept(nothrow<T>){
6138 return base_call(a,b);
6139 }
6140
6142 size_t _size;
6143 template<class T> requires able<T>
6144 force_inline T*operator()(T*to,const T*from)const noexcept(nothrow<T>){
6145 return base_call(to,from,_size);
6146 }
6147 template<class T> requires able<T>
6148 force_inline T*operator()(note::to_t<T*>to,note::from_t<const T*>from)const noexcept(nothrow<T>){
6149 return operator()(to(),from());
6150 }
6151 template<class T> requires able<T>
6152 force_inline T*operator()(note::from_t<const T*>from,note::to_t<T*>to)const noexcept(nothrow<T>){
6153 return operator()(to(),from());
6154 }
6155 template<class T> requires able<T>
6156 force_inline T*operator()(const T&from,note::to_t<T*>to)const noexcept(nothrow<T>){
6157 return base_call(to(),from,_size);
6158 }
6159 template<class T> requires able<T>
6160 force_inline T*operator()(note::to_t<T*>to,const T&from)const noexcept(nothrow<T>){
6161 return base_call(to(),from,_size);
6162 }
6163 };
6164 [[nodiscard]]force_inline constexpr array_copy_assign_t operator[](size_t a)const noexcept{return{a};}
6165 }copy_assign{};
6166
6167 constexpr struct move_assign_t{
6168 template<class T>
6169 static constexpr bool r_able=move_assign_able<T>;
6170 template<class T>
6171 static constexpr bool able=r_able<T>?true:copy_assign.able<T>;
6172 template<class T>
6173 static constexpr bool nothrow=r_able<T>?move_assign_nothrow<T>:copy_assign.nothrow<T>;
6174 template<class T>
6175 static constexpr bool trivial=r_able<T>?move_assign_trivial<T>:copy_assign.trivial<T>;
6176
6177 template<class T> requires able<T>
6178 static T& base_call(T&a,T&&b)noexcept(nothrow<T>){
6179 if constexpr(r_able<T>)
6180 a=move(b);
6181 else{
6182 copy_assign(a,b);
6183 }
6184 return a;
6185 }
6186 template<class T> requires able<T>
6187 static T* base_call(T*to,T*from,size_t size)noexcept(nothrow<T>){
6188 if constexpr(trivial<T>)
6189 ::std::memcpy(to,add_const(from),size*sizeof(T));
6190 else{
6191 while(size--)
6192 base_call(to[size],from[size]);
6193 }
6194 return to;
6195 }
6196
6197 template<class T> requires able<T>
6198 force_inline T& operator()(T&a,T&b)const noexcept(nothrow<T>){
6199 return base_call(a,move(b));
6200 }
6201
6203 size_t _size;
6204 template<class T> requires able<T>
6205 force_inline T*operator()(T*to,T*from)const noexcept(nothrow<T>){
6206 return base_call(to,from,_size);
6207 }
6208 template<class T> requires able<T>
6209 force_inline T*operator()(note::to_t<T*>to,note::from_t<T*>from)const noexcept(nothrow<T>){
6210 return operator()(to(),from());
6211 }
6212 template<class T> requires able<T>
6213 force_inline T*operator()(note::from_t<T*>from,note::to_t<T*>to)const noexcept(nothrow<T>){
6214 return operator()(to(),from());
6215 }
6216 };
6217 [[nodiscard]]force_inline constexpr array_move_assign_t operator[](size_t a)const noexcept{return{a};}
6218 }move_assign{};
6219 }
6220
6221 //file_end
6222
6223 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/lifetime/_body.hpp"
6224 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/lifetime/_export.hpp"
6225 //_export.hpp
6226 //at namespace elc::defs::memory
6227 /*
6228 未完成的elc解释器base文件
6229 由steve02081504与Alex0125设计、编写
6230 转载时请在不对此文件做任何修改的同时注明出处
6231 项目地址:https://github.com/steve02081504/ELC
6232 */
6233 #define export using lifetime_n::
6234 export construct;
6235 export destruct;
6236 export re_construct;
6237 export copy_assign;
6238 export move_assign;
6239 export move;
6240 export copy;
6241 export copy_construct;
6242 export move_construct;
6243 #undef export
6244
6245 //file_end
6246
6247 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/lifetime/_body.hpp"
6248 #if defined(ELC_TEST_ON)
6249 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/lifetime/_test.hpp"
6250 //_test.hpp
6251 //at namespace elc::defs::memory
6252 /*
6253 未完成的elc解释器base文件
6254 由steve02081504与Alex0125设计、编写
6255 转载时请在不对此文件做任何修改的同时注明出处
6256 项目地址:https://github.com/steve02081504/ELC
6257 */
6258 namespace lifetime_n{
6259 //BLOCK:for debug
6260 inline void test(){
6261 ELC_TEST_EVENTNAME("lifetime部分测试");
6262 }
6263 inline void test_log_out(){
6264 }
6265 inline void test_end(){
6266 }
6267 //BLOCK_END
6268 }
6269
6270 //file_end
6271
6272 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/lifetime/_body.hpp"
6273 #endif
6274
6275 //file_end
6276
6277 #line 23 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
6278 }
6279 namespace base{
6280 //依赖lifetime
6281 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/_body.hpp"
6282 //_body.hpp
6283 //at namespace elc::defs::base
6284 /*
6285 未完成的elc解释器base文件
6286 由steve02081504与Alex0125设计、编写
6287 转载时请在不对此文件做任何修改的同时注明出处
6288 项目地址:https://github.com/steve02081504/ELC
6289 */
6290 //D?
6291 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/flag.hpp"
6292 //flag.hpp
6293 //at namespace elc::defs::base
6294 /*
6295 未完成的elc解释器base文件
6296 由steve02081504与Alex0125设计、编写
6297 转载时请在不对此文件做任何修改的同时注明出处
6298 项目地址:https://github.com/steve02081504/ELC
6299 */
6300 /*
6301 表示flag是否被设置的enum字面量.
6302 */
6303 enum flag_set_type:bool{seted=true,not_set=false};
6304 /*
6305 bool的简易包装以表示『是否被设置』,无法使用operator=,因为不应如此.
6306 */
6307 class flag{
6308 bool _m;
6309 public:
6310 constexpr explicit flag(flag_set_type a=not_set)noexcept:_m(bool(a)){}
6311 [[nodiscard]]explicit operator bool()const noexcept{return _m;}
6312 flag(flag&a)noexcept:_m((bool)a){}
6313 flag(flag&&a)noexcept:_m((bool)a){}
6314 inline void operator=(flag&)&noexcept=delete;
6315 inline void operator=(flag&&)&noexcept=delete;
6316 inline void set()noexcept{_m=true;}
6317 inline void unset()noexcept{_m=false;}
6318 };
6319
6320 //file_end
6321
6322 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/_body.hpp"
6323 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/mark_type.hpp"
6324 //mark_type.hpp
6325 //at namespace elc::defs::base
6326 /*
6327 未完成的elc解释器base文件
6328 由steve02081504与Alex0125设计、编写
6329 转载时请在不对此文件做任何修改的同时注明出处
6330 项目地址:https://github.com/steve02081504/ELC
6331 */
6332 /*
6333 表明是否被标记的enum字面量.
6334 */
6335 enum mark_type:bool{marked=true,not_mark=false};
6336 /*
6337 用于gc的可达性分析的普通模板式elc属性.
6338 */
6339 template<typename T>
6341 mutable flag _m;
6342 public:
6343 constexpr explicit mark_able(mark_type a=not_mark)noexcept:_m(a==not_mark?not_set:seted){};
6344 inline void mark()const noexcept{_m.set();}
6345 inline void unmark()const noexcept{_m.unset();}
6346 [[nodiscard]]bool was_marked()const noexcept{return(bool)_m;}
6347 };
6348
6349 //file_end
6350
6351 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/_body.hpp"
6352
6353 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/iterator.hpp"
6354 //iterator.hpp
6355 //at namespace elc::defs::base
6356 /*
6357 未完成的elc解释器base文件
6358 由steve02081504与Alex0125设计、编写
6359 转载时请在不对此文件做任何修改的同时注明出处
6360 项目地址:https://github.com/steve02081504/ELC
6361 */
6362 namespace iterator_n{
6363 using namespace memory;//copy_assign、move_assign
6364 template<typename base_t_w>
6367 typedef remove_cv<base_t_w> base_t_rw;
6368 base_t_rw _m;
6369 template<typename build_base_t_T> requires(construct<base_t_rw>.able<build_base_t_T>)
6370 constexpr reverse_base_t(build_base_t_T&& a)noexcept(construct<base_t_rw>.nothrow<build_base_t_T>):_m(a){}
6371 [[nodiscard]]auto get_before()noexcept_as(declvalue(base_t_w).get_next()){ return ((base_t_w&)_m).get_next(); }
6372 [[nodiscard]]auto get_next()noexcept_as(declvalue(base_t_w).get_before()){ return ((base_t_w&)_m).get_before(); }
6373 [[nodiscard]]auto get_handle()noexcept_as(declvalue(base_t_w).get_handle()){ return ((base_t_w&)_m).get_handle(); }
6374 };
6375 template<typename base_t> requires(compare.able<base_t>)
6376 [[nodiscard]]auto operator<=>(const reverse_base_t<base_t>&a,const reverse_base_t<base_t>&b)noexcept(compare.nothrow<base_t>){
6377 return compare((const base_t&)b._m,(const base_t&)a._m);
6378 }
6379 template<typename base_t,typename T> requires(compare.able<T,base_t> && type_info<remove_cvref<T>> != type_info<reverse_base_t<base_t>::base_t_rw>)
6380 [[nodiscard]]auto operator<=>(const reverse_base_t<base_t>& a,T&& b)noexcept(compare.nothrow<T,base_t>){
6381 return compare(b,(const base_t&)a._m);
6382 }
6383 template<typename base_t,typename T> requires(compare.able<base_t,T> && type_info<remove_cvref<T>> != type_info<reverse_base_t<base_t>::base_t_rw>)
6384 [[nodiscard]]auto operator<=>(T&& a,const reverse_base_t<base_t>& b)noexcept(compare.nothrow<base_t,T>){
6385 return compare((const base_t&)b._m,a);
6386 }
6387 template<typename base_t,typename T> requires(equal.able<T,base_t>)
6388 [[nodiscard]]auto operator==(const reverse_base_t<base_t>& a,T&& b)noexcept(equal.nothrow<T,base_t>){
6389 return equal(b,(const base_t&)a._m);
6390 }
6391 template<typename base_t,typename T> requires(equal.able<base_t,T>)
6392 [[nodiscard]]auto operator==(T&& a,const reverse_base_t<base_t>& b)noexcept(equal.nothrow<base_t,T>){
6393 return equal((const base_t&)b._m,a);
6394 }
6395
6396 template<typename value_t,typename base_t_w>
6398 template<typename,typename>
6399 friend class same_base_t;
6400 protected:
6402 typedef remove_cv<base_t_w> base_t_rw;
6403 //
6404 mutable base_t_rw _m;
6405 //
6406 [[nodiscard]]static constexpr bool is_handle_getter_noexcept()noexcept{
6407 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6408 return true;
6409 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_handle()))
6410 return noexcept(declvalue(base_t_w)->get_handle());
6411 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_handle()))
6412 return noexcept(declvalue(base_t_w).get_handle());
6413 }
6414 [[nodiscard]]inline value_t*handle_getter()const noexcept(is_handle_getter_noexcept()){
6415 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6416 return ((base_t_w)_m);
6417 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_handle()))
6418 return ((base_t_w)_m)->get_handle();
6419 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_handle()))
6420 return ((base_t_w)_m).get_handle();
6421 }
6422 //
6423 [[nodiscard]]static constexpr bool is_value_getter_noexcept()noexcept{
6424 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6425 return true;
6426 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_value()))
6427 return noexcept(declvalue(base_t_w)->get_value());
6428 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_value()))
6429 return noexcept(declvalue(base_t_w).get_value());
6430 }
6431
6432 [[nodiscard]]static constexpr auto value_type_getter(){
6433 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6434 return type_info<decltype(*((base_t_w)_m))>;
6435 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_value()))
6436 return type_info<decltype(((base_t_w)_m)->get_value())>;
6437 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_value()))
6438 return type_info<decltype(((base_t_w)_m).get_value())>;
6439 else
6440 return type_info<decltype(*declvalue(value_t*))>;
6441 }
6442 typedef decltype(value_type_getter())::template_name type value_type;
6443
6444 [[nodiscard]]inline value_type value_getter()const noexcept(is_handle_getter_noexcept()){
6445 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6446 return *((base_t_w)_m);
6447 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_value()))
6448 return ((base_t_w)_m)->get_value();
6449 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_value()))
6450 return ((base_t_w)_m).get_value();
6451 else
6452 return *handle_getter();
6453 }
6454 //
6455 [[nodiscard]]static constexpr bool is_next_getter_noexcept()noexcept{
6456 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6457 return true;
6458 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_next()))
6459 return noexcept(declvalue(base_t_w)->get_next());
6460 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_next()))
6461 return noexcept(declvalue(base_t_w).get_next());
6462 }
6463 [[nodiscard]]inline base_t_w next_getter()const noexcept(is_next_getter_noexcept()){
6464 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6465 return ((base_t_w)_m)+1;
6466 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_next()))
6467 return ((base_t_w)_m)->get_next();
6468 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_next()))
6469 return ((base_t_w)_m).get_next();
6470 }
6471 //
6472 [[nodiscard]]static constexpr bool is_before_getter_noexcept()noexcept{
6473 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6474 return true;
6475 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_before()))
6476 return noexcept(declvalue(base_t_w)->get_before());
6477 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_before()))
6478 return noexcept(declvalue(base_t_w).get_before());
6479 }
6480 [[nodiscard]]inline base_t_w before_getter()const noexcept(is_before_getter_noexcept()){
6481 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6482 return ((base_t_w)_m)-1;
6483 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w)->get_before()))
6484 return ((base_t_w)_m)->get_before();
6485 elseif constexpr(was_not_an_ill_form(declvalue(base_t_w).get_before()))
6486 return ((base_t_w)_m).get_before();
6487 }
6488 public:
6489 constexpr void swap_with(this_t&a)noexcept_as(swap(declvalue(base_t_rw&),declvalue(base_t_rw&))){swap(_m,a._m);}
6490 //
6491 constexpr same_base_t()noexcept=default;
6492 template<typename build_base_t_T> requires(construct<base_t_rw>.able<build_base_t_T>)
6493 constexpr same_base_t(build_base_t_T&&a)noexcept(construct<base_t_rw>.nothrow<build_base_t_T>):_m(a){}
6494 constexpr same_base_t(const this_t&a)noexcept(construct<base_t_rw>.nothrow<const base_t_rw>):_m(a._m){}
6495 constexpr same_base_t(this_t&&a)noexcept_as(declvalue(this_t).swap_with(a)){swap_with(a);}
6496 template<typename other_T,typename other_base_t> requires(construct<base_t_rw>.able<other_base_t>)
6497 constexpr same_base_t(const same_base_t<other_T,other_base_t>&a)noexcept(construct<base_t_rw>.nothrow<other_base_t>):_m(a._m){}
6498 ~same_base_t()noexcept(destruct.nothrow<base_t_rw>)=default;
6499 [[nodiscard]]constexpr bool operator==(const this_t& a)const noexcept_as(declvalue(base_t_rw) == declvalue(base_t_rw)){ return _m == a._m; }
6500 [[nodiscard]]constexpr value_t* operator->()noexcept(is_handle_getter_noexcept()){ return handle_getter(); }
6501 [[nodiscard]]constexpr value_type operator*()noexcept_as(is_value_getter_noexcept()){ return value_getter(); }
6502 [[nodiscard]]constexpr operator value_t*()noexcept_as(declvalue(this_t).operator->()){ return operator->(); }
6503 [[nodiscard]]constexpr bool operator==(value_t* a)const noexcept(is_handle_getter_noexcept()&&noexcept(pointer_equal(declvalue(value_t*),declvalue(value_t*)))){ return pointer_equal(handle_getter(),a); }
6504 template<typename other_value_t,typename other_base_t_w> requires(equal.able<base_t_rw,other_base_t_w>)
6505 [[nodiscard]]constexpr bool operator==(const same_base_t<other_value_t,other_base_t_w>& a)const noexcept(equal.nothrow<base_t_rw,other_base_t_w>){
6506 return equal(_m,a._m);
6507 }
6508 template<typename other_value_t,typename other_base_t_w>
6509 [[nodiscard]]constexpr auto operator<=>(const same_base_t<other_value_t,other_base_t_w>& a)const noexcept(compare.nothrow<base_t_rw,other_base_t_w>){
6510 if constexpr(compare.able<base_t_rw,other_base_t_w>)
6511 return compare(_m,a._m);
6512 }
6513 };
6514 template<typename value_t,typename base_t_w>
6515 inline void swap(same_base_t<value_t,base_t_w>&a,same_base_t<value_t,base_t_w>&b)noexcept_as(a.swap_with(b))
6516 {a.swap_with(b);}
6517
6518 template<typename value_t,typename base_t_w>
6519 struct base_iterator_t:same_base_t<value_t,base_t_w>{
6522 protected:
6523 using base_t::is_before_getter_noexcept;
6524 using base_t::is_next_getter_noexcept;
6525 using base_t::before_getter;
6526 using base_t::next_getter;
6527 typedef remove_cv<base_t_w> base_t_rw;
6528 public:
6529 using base_t::base_t;
6530 constexpr this_t&operator=(const base_t_rw&a)&noexcept(copy_assign.nothrow<base_t_rw>){copy_assign(base_t::_m,a);return*this;}
6531 constexpr this_t&operator=(base_t_rw&&a)&noexcept(move_assign.nothrow<base_t_rw>){move_assign(base_t::_m,a);return*this;}
6532 constexpr this_t&operator++()&noexcept(is_next_getter_noexcept()){return*this=next_getter();}
6533 constexpr this_t&operator--()&noexcept(is_before_getter_noexcept()){return*this=before_getter();}
6534 constexpr this_t operator++(int)&noexcept_as(this_t(++declvalue(this_t&))){auto a=*this;operator++();return a;}
6535 constexpr this_t operator--(int)&noexcept_as(this_t(--declvalue(this_t&))){auto a=*this;operator--();return a;}
6536 constexpr this_t operator+(ptrdiff_t num)const noexcept_as(this_t(--declvalue(this_t&)),++declvalue(this_t&)){
6537 if constexpr(type_info<::std::remove_pointer_t<base_t_w>> == type_info<value_t>)
6538 return base_t::_m+num;
6539 else{
6540 auto a=*this;
6541 if(num>0)
6542 while(num--)
6543 ++a;
6544 else
6545 while(num++)
6546 --a;
6547 return a;
6548 }
6549 }
6550 constexpr this_t operator-(ptrdiff_t num)const noexcept_as(declvalue(this_t&)+0){ return *this+(-num); }
6551 };
6552 template<typename value_t,typename base_t_w>
6554 template<typename value_t,typename base_t_w>
6556
6557 template<typename value_t,typename base_t_w=value_t*>
6559 template<typename value_t,typename base_t_w=const value_t*>
6561 template<typename value_t,typename base_t_w=value_t*>
6563 template<typename value_t,typename base_t_w=const value_t*>
6565 }
6571
6572 //file_end
6573
6574 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/_body.hpp"
6575 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/list.hpp"
6576 //list.hpp
6577 //at namespace elc::defs::base
6578 /*
6579 未完成的elc解释器base文件
6580 由steve02081504与Alex0125设计、编写
6581 转载时请在不对此文件做任何修改的同时注明出处
6582 项目地址:https://github.com/steve02081504/ELC
6583 */
6584 //copy from old ELC
6585 template<typename T>
6586 class list_t;
6587 /*
6588 common attribute,表明这是对于list_t可加入的cons.
6589 */
6590 template<typename T>
6591 struct cons_t:non_copyable,non_moveable,is_common_attribute(cons_t){
6592 typedef cons_t<T> this_t;
6593 private:
6594 friend list_t<T>;
6595 friend iterator_t<T,this_t*>::base_t;
6597
6598 mutable this_t*_before;//为了在析构时修改前一项的next,勿删
6599 mutable this_t*_next;
6600
6601 [[nodiscard]]this_t*get_before()noexcept{return _before;}
6602 [[nodiscard]]this_t*get_next()noexcept{return _next;}
6603
6604 constexpr cons_t(this_t*a,this_t*b):_before(a),_next(b){}
6605
6606 constexpr void set_before(this_t*a){
6607 _before=a;
6608 a->_next=this;
6609 }
6610 constexpr void set_next(this_t*a){
6611 _next=a;
6612 a->_before=this;
6613 }
6614 constexpr void insert_to_before(this_t*a){
6615 set_before(a->_before);
6616 set_next(a);
6617 }
6618 constexpr void bind_with(this_t*a)noexcept{
6619 set_next(a);
6620 set_before(a);
6621 }
6622 constexpr void remove_from_list()noexcept{
6623 _before->set_next(_next);
6624 }
6625 [[nodiscard]]constexpr T*get_handle(){
6626 return attribute_t::get_handle();
6627 }
6628 public:
6629 constexpr cons_t()=default;
6630 ~cons_t(){
6631 remove_from_list();
6632 }
6633 };
6634 /*
6635 T类型的有序双向list.
6636 方法有:
6637 constexpr void add(cons_t<T>*a)noexcept;
6638 constexpr iterator begin()noexcept;
6639 constexpr iterator end()noexcept;
6640 constexpr iterator head()noexcept;
6641 constexpr bool empty()const noexcept;
6642 */
6643 template<typename T>
6644 struct list_t{
6645 typedef list_t<T> this_t;
6646 typedef cons_t<T> cons;
6647 typedef iterator_t<T,cons*>iterator;
6648 private:
6649 cons _begin,_end;
6650 public:
6651 constexpr list_t()noexcept{_begin.bind_with(&_end);}
6652 inline constexpr void add(cons*a)noexcept{
6653 a->insert_to_before(&_end);
6654 }
6655 [[nodiscard]]constexpr iterator begin()noexcept{return _begin.get_next();}//这叫头迭代器
6656 [[nodiscard]]constexpr iterator end()noexcept{return&_end;}//这叫超尾迭代器
6657 [[nodiscard]]constexpr iterator head()noexcept{return&_begin;}//。。。。这个大概就是超头迭代器了😂
6658 [[nodiscard]]constexpr bool empty()const noexcept{return _begin.get_next()==&_end;}
6659 };
6660
6661 //file_end
6662
6663 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/_body.hpp"
6664
6665 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/function_base.hpp"
6666 //function_base.hpp
6667 //at namespace elc::defs::container
6668 /*
6669 未完成的elc解释器base文件
6670 由steve02081504与Alex0125设计、编写
6671 转载时请在不对此文件做任何修改的同时注明出处
6672 项目地址:https://github.com/steve02081504/ELC
6673 */
6674 namespace function_base_n{
6675 #if !defined(_MSC_VER)
6676 template<typename>
6678
6679 template<typename Ret_t,typename T,typename...Args_t,bool nothrow>
6680 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)noexcept(nothrow)>
6681 {using type=Ret_t(Args_t...)noexcept(nothrow);};
6682
6683 template<typename Ret_t,typename T,typename...Args_t,bool nothrow>
6684 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)&noexcept(nothrow)>
6685 {using type=Ret_t(Args_t...)noexcept(nothrow);};
6686
6687 template<typename Ret_t,typename T,typename...Args_t,bool nothrow>
6688 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)const noexcept(nothrow)>
6689 {using type=Ret_t(Args_t...)noexcept(nothrow);};
6690
6691 template<typename Ret_t,typename T,typename...Args_t,bool nothrow>
6692 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)const&noexcept(nothrow)>
6693 {using type=Ret_t(Args_t...)noexcept(nothrow);};
6694
6695 template<typename T>
6696 [[nodiscard]]constexpr auto function_type_getter_conditional_helper(){
6697 if constexpr(::std::is_function_v<T>)
6698 return type_info<T>;
6699 elseif constexpr(is_pointer<T> && ::std::is_function_v<::std::remove_pointer_t<T>>)//不支持多级函数指针:懒得写(其实挺简单的),而且function_t若支持多级函数指针的推导指引会很不安全
6700 return function_type_getter_conditional_helper<::std::remove_pointer_t<T>>();
6701 else
6702 return type_info<type_name function_type_getter_helper<decltype(&T::operator())>::type>;
6703 }
6704 template<typename T>
6706 typedef decltype(function_type_getter_conditional_helper<T>())::template_name type type;
6707 };
6708
6709 /*
6710 获取一个callable类型的“函数类型”
6711 如T(int)返回char,其函数类型便是char(int)
6712 */
6713 template<typename T>
6714 using get_function_type=function_type_getter<T>::type;
6715
6716 /*
6717 用处:容纳一个callable类型(除过函数类型,但可以是其指针)并提供operator()
6718 小包装工具,能在意想不到的地方发挥效果(比如要额外携带数据的callable类型定义!见"../../lib_loader/lib_loader.hpp")
6719 */
6720 template<class T,class Func_t=get_function_type<T>>
6722 template<class T,bool nothrow,class Ret_t,class...Args_t>
6723 struct function_data_warpper_t<T,Ret_t(Args_t...)noexcept(nothrow)>{
6724 static_assert(!::std::is_function_v<T>);
6725
6726 T _value;
6727
6728 function_data_warpper_t(T a)noexcept(construct<T>.nothrow<T>):_value(a){}
6729 ~function_data_warpper_t()noexcept(destruct.nothrow<T>)=default;
6730 Ret_t operator()(Args_t...args)noexcept(nothrow || invoke<T>.nothrow<Args_t...>){
6731 //BLOCK:constexpr checks
6732 if constexpr(!invoke<T>.able<Args_t...>)
6733 template_error("this T can\'t becall as args.");
6734 if constexpr(was_an_ill_form(static_cast<Ret_t>(declvalue(T)(declvalue(Args_t)...))))
6735 template_error("the return type of T was wrong.");
6736 //BLOCK_END
6737 if constexpr(type_info<Ret_t> != type_info<void>)
6738 return _value(forward<Args_t>(args)...);
6739 else
6740 _value(forward<Args_t>(args)...);
6741 }
6742 Ret_t operator()(Args_t...args)const noexcept(nothrow || invoke<const T>.nothrow<Args_t...>) requires(invoke<const T>.able<Args_t...>){
6743 //BLOCK:constexpr checks
6744 if constexpr(!invoke<T>.able<Args_t...>)
6745 template_error("this T can\'t becall as args.");
6746 if constexpr(was_an_ill_form(static_cast<Ret_t>(declvalue(T)(declvalue(Args_t)...))))
6747 template_error("the return type of T was wrong.");
6748 //BLOCK_END
6749 if constexpr(type_info<Ret_t> != type_info<void>)
6750 return _value(forward<Args_t>(args)...);
6751 else
6752 _value(forward<Args_t>(args)...);
6753 }
6754 [[nodiscard]]auto&get_data()noexcept{return _value;}
6755 };
6756 #else
6757 //MSVC,我滴垃圾堆
6758 template<typename>
6760
6761 template<typename Ret_t,typename T,typename...Args_t>
6762 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)>
6763 {using type=Ret_t(Args_t...);};
6764
6765 template<typename Ret_t,typename T,typename...Args_t>
6766 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)&>
6767 {using type=Ret_t(Args_t...);};
6768
6769 template<typename Ret_t,typename T,typename...Args_t>
6770 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)const>
6771 {using type=Ret_t(Args_t...);};
6772
6773 template<typename Ret_t,typename T,typename...Args_t>
6774 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)const&>
6775 {using type=Ret_t(Args_t...);};
6776
6777 template<typename Ret_t,typename T,typename...Args_t>
6778 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)noexcept>
6779 {using type=Ret_t(Args_t...)noexcept;};
6780
6781 template<typename Ret_t,typename T,typename...Args_t>
6782 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)&noexcept>
6783 {using type=Ret_t(Args_t...)noexcept;};
6784
6785 template<typename Ret_t,typename T,typename...Args_t>
6786 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)const noexcept>
6787 {using type=Ret_t(Args_t...)noexcept;};
6788
6789 template<typename Ret_t,typename T,typename...Args_t>
6790 struct function_type_getter_helper<Ret_t(T::*)(Args_t...)const&noexcept>
6791 {using type=Ret_t(Args_t...)noexcept;};
6792
6793 template<typename T>
6794 [[nodiscard]]constexpr auto function_type_getter_conditional_helper(){
6795 if constexpr(::std::is_function_v<T>)
6796 return type_info<T>;
6797 elseif constexpr(is_pointer<T> && ::std::is_function_v<::std::remove_pointer_t<T>>)//不支持多级函数指针:懒得写(其实挺简单的),而且function_t若支持多级函数指针的推导指引会很不安全
6798 return function_type_getter_conditional_helper<::std::remove_pointer_t<T>>();
6799 else
6800 return type_info<type_name function_type_getter_helper<decltype(&T::operator())>::type>;
6801 }
6802 template<typename T>
6803 struct function_type_getter{
6804 typedef decltype(function_type_getter_conditional_helper<T>())::template_name type type;
6805 };
6806
6807 /*
6808 获取一个callable类型的“函数类型”
6809 如T(int)返回char,其函数类型便是char(int)
6810 */
6811 template<typename T>
6812 using get_function_type=function_type_getter<T>::type;
6813
6814 /*
6815 用处:容纳一个callable类型(除过函数类型,但可以是其指针)并提供operator()
6816 小包装工具,能在意想不到的地方发挥效果(比如要额外携带数据的callable类型定义!见"../../lib_loader/lib_loader.hpp")
6817 */
6818 template<class T,class Func_t=get_function_type<T>>
6819 class function_data_warpper_t;
6820 template<class T,class Ret_t,class...Args_t>
6821 struct function_data_warpper_t<T,Ret_t(Args_t...)noexcept>{
6822 static_assert(!::std::is_function_v<T>);
6823
6824 T _value;
6825
6826 function_data_warpper_t(T a)noexcept(construct<T>.nothrow<T>):_value(a){}
6827 ~function_data_warpper_t()noexcept(destruct.nothrow<T>)=default;
6828 Ret_t operator()(Args_t...args)noexcept{
6829 //BLOCK:constexpr checks
6830 if constexpr(!invoke<T>.able<Args_t...>)
6831 template_error("this T can\'t becall as args.");
6832 if constexpr(was_an_ill_form(static_cast<Ret_t>(declvalue(T)(declvalue(Args_t)...))))
6833 template_error("the return type of T was wrong.");
6834 //BLOCK_END
6835 if constexpr(type_info<Ret_t> != type_info<void>)
6836 return _value(forward<Args_t>(args)...);
6837 else
6838 _value(forward<Args_t>(args)...);
6839 }
6840 Ret_t operator()(Args_t...args)const noexcept requires(invoke<const T>.able<Args_t...>){
6841 //BLOCK:constexpr checks
6842 if constexpr(!invoke<T>.able<Args_t...>)
6843 template_error("this T can\'t becall as args.");
6844 if constexpr(was_an_ill_form(static_cast<Ret_t>(declvalue(T)(declvalue(Args_t)...))))
6845 template_error("the return type of T was wrong.");
6846 //BLOCK_END
6847 if constexpr(type_info<Ret_t> != type_info<void>)
6848 return _value(forward<Args_t>(args)...);
6849 else
6850 _value(forward<Args_t>(args)...);
6851 }
6852 [[nodiscard]]auto&get_data()noexcept{return _value;}
6853 };
6854 /*
6855 用处:容纳一个callable类型(除过函数类型,但可以是其指针)并提供operator()
6856 小包装工具,能在意想不到的地方发挥效果(比如要额外携带数据的callable类型定义!见"../../lib_loader/lib_loader.hpp")
6857 */
6858 template<class T,class Ret_t,class...Args_t>
6859 struct function_data_warpper_t<T,Ret_t(Args_t...)>{
6860 static_assert(!::std::is_function_v<T>);
6861
6862 T _value;
6863
6864 function_data_warpper_t(T a)noexcept(construct<T>.nothrow<T>):_value(a){}
6865 ~function_data_warpper_t()noexcept(destruct.nothrow<T>)=default;
6866 Ret_t operator()(Args_t...args)noexcept(invoke<T>.nothrow<Args_t...>){
6867 //BLOCK:constexpr checks
6868 if constexpr(!invoke<T>.able<Args_t...>)
6869 template_error("this T can\'t becall as args.");
6870 if constexpr(was_an_ill_form(static_cast<Ret_t>(declvalue(T)(declvalue(Args_t)...))))
6871 template_error("the return type of T was wrong.");
6872 //BLOCK_END
6873 if constexpr(type_info<Ret_t> != type_info<void>)
6874 return _value(forward<Args_t>(args)...);
6875 else
6876 _value(forward<Args_t>(args)...);
6877 }
6878 Ret_t operator()(Args_t...args)const noexcept(invoke<const T>.nothrow<Args_t...>) requires(invoke<const T>.able<Args_t...>){
6879 //BLOCK:constexpr checks
6880 if constexpr(!invoke<T>.able<Args_t...>)
6881 template_error("this T can\'t becall as args.");
6882 if constexpr(was_an_ill_form(static_cast<Ret_t>(declvalue(T)(declvalue(Args_t)...))))
6883 template_error("the return type of T was wrong.");
6884 //BLOCK_END
6885 if constexpr(type_info<Ret_t> != type_info<void>)
6886 return _value(forward<Args_t>(args)...);
6887 else
6888 _value(forward<Args_t>(args)...);
6889 }
6890 [[nodiscard]]auto&get_data()noexcept{return _value;}
6891 [[nodiscard]]const auto&get_data()const noexcept{return _value;}
6892 };
6893 #endif
6894 }
6895 using function_base_n::get_function_type;
6896 using function_base_n::function_data_warpper_t;
6897
6898 //file_end
6899
6900 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/tools/_body.hpp"
6901
6902 //file_end
6903
6904 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
6905 }
6906
6907 namespace memory{
6908 //依赖list
6909 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/_body.hpp"
6910 //_body.hpp
6911 //at namespace elc::defs::memory
6912 /*
6913 未完成的elc解释器base文件
6914 由steve02081504与Alex0125设计、编写
6915 转载时请在不对此文件做任何修改的同时注明出处
6916 项目地址:https://github.com/steve02081504/ELC
6917 */
6918 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/_body.hpp"
6919 //_body.hpp
6920 //at namespace elc::defs::memory
6921 /*
6922 未完成的elc解释器base文件
6923 由steve02081504与Alex0125设计、编写
6924 转载时请在不对此文件做任何修改的同时注明出处
6925 项目地址:https://github.com/steve02081504/ELC
6926 */
6927 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/defs.hpp"
6928 //defs.hpp
6929 //at namespace elc::defs::memory
6930 /*
6931 未完成的elc解释器base文件
6932 由steve02081504与Alex0125设计、编写
6933 转载时请在不对此文件做任何修改的同时注明出处
6934 项目地址:https://github.com/steve02081504/ELC
6935 */
6936 namespace gc_n{
6937 void gc_for_alloc()noexcept;
6938 }
6939 namespace alloc_n{
6940 using ::elc::defs::memory::gc_n::gc_for_alloc;
6941
6942 //允许自定义对象的alloc/free/realloc/get_size_of_alloc方法:为pool留的后门(大概)
6943 //这里是缺省时的默认方法定义
6944 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/default_method/defs.hpp"
6945 //defs.hpp
6946 //at namespace elc::defs::memory::alloc_n
6947 /*
6948 未完成的elc解释器base文件
6949 由steve02081504与Alex0125设计、编写
6950 转载时请在不对此文件做任何修改的同时注明出处
6951 项目地址:https://github.com/steve02081504/ELC
6952 */
6953 namespace default_method{
6954 //BLOCK:for debug
6955 #if defined(_MSC_VER)
6956 #if defined(ELC_TEST_CHECK_MEMORY_LACK)
6957 #pragma detect_mismatch("ELC_TEST_CHECK_MEMORY_LACK","true")
6958 #else
6959 #pragma detect_mismatch("ELC_TEST_CHECK_MEMORY_LACK","false")
6960 #endif
6961 #endif
6962
6963 [[nodiscard]]inline byte*base_realloc(byte*ptr,size_t nsize,size_t align)noexcept{
6964 byte*p=::elc::APIs::alloc::realloc(ptr,nsize,align);
6965 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
6966 if(nsize==0)
6967 stest_uneventlog(ptr);
6968 if(p){
6969 ELC_TEST_EVENTNAME("base_realloc调用");
6970 if(p!=ptr)
6971 stest_uneventlog(ptr);
6972 stest_eventlog(p);
6973 }
6974 #endif
6975 return p;
6976 }
6977 [[nodiscard]]inline byte*base_aligned_alloc(size_t align,size_t size)noexcept{
6978 byte*p=::elc::APIs::alloc::aligned_alloc(align,size);
6979 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
6980 if(p){
6981 ELC_TEST_EVENTNAME("base_aligned_alloc调用");
6982 stest_eventlog(p);
6983 }
6984 #endif
6985 return p;
6986 }
6987 inline void base_free(byte*p,size_t align)noexcept{
6988 //传入需释放的数据块起始点与大小(字节)
6989 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
6990 auto tmp=stest_geteventlistfromlog(p);
6991 if(!tmp){
6992 stest_putsf(L"释放了已释放或未分配指针%p,当前的事件记录如下:",p);
6993 stest_printeventlist(stderr,stest_geteventlist());
6994 stest_wait();
6995 return;
6996 }else{
6997 stest_deleteevent(tmp);
6998 stest_uneventlog(p);
6999 }
7000 #endif
7001 ::elc::APIs::alloc::free(p,align);
7002 }
7003 inline size_t base_get_size_of_alloc(const byte*arg, size_t align)noexcept{
7004 //arg保证不与null_ptr相等
7005 const auto tmp= ::elc::APIs::alloc::get_size_of_alloc(arg,align);
7006 return tmp;
7007 }
7008 //BLOCK_END
7009
7010 template<typename T>
7011 inline void*alloc_method(type_info_t<T>)noexcept{
7012 //return空指针被允许,会引起gc_for_alloc
7013 return ::std::assume_aligned<alignof(T)>(base_aligned_alloc(alignof(T),sizeof(T)));
7014 }
7015 template<typename T>
7016 inline void*alloc_method(type_info_t<T>,size_t size)noexcept{
7017 //return空指针被允许,会引起gc_for_alloc
7018 //size被保证不为0
7019 if constexpr(type_info<T>.has_attribute(never_in_array))
7020 template_error("You cannot perform array operations on never_in_array type.");
7021 return ::std::assume_aligned<alignof(T)>(base_aligned_alloc(alignof(T),sizeof(T)*size));
7022 }
7023 template<typename T>
7024 inline size_t get_size_of_alloc_method(const T*arg)noexcept{
7025 //arg保证不与null_ptr相等
7026 return base_get_size_of_alloc(cast_to_data(arg),alignof(T))/sizeof(T);
7027 }
7028 template<typename T>
7029 inline void free_method(T*arg)noexcept{
7030 base_free(cast_to_data(arg),alignof(T));
7031 }
7032 template<typename T>
7033 inline void*realloc_method(T*&ptr,size_t new_size)noexcept{
7034 //return空指针被允许,会引起gc_for_alloc,但ptr值必须保持有效以保证gc_for_alloc后再次realloc有效
7035 //new_size被保证不为0
7036 //align维持不变
7037 //但只允许在扩大数据块时可选的移动数据块
7038 if constexpr(type_info<T>.has_attribute(never_in_array))
7039 template_error("You cannot perform array operations on never_in_array type.");
7040 return ptr=reinterpret_cast<T*>(base_realloc(cast_to_data(ptr),sizeof(T)*new_size,alignof(T)));
7041 }
7042 }
7043
7044 //file_end
7045
7046 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/defs.hpp"
7047
7048 enable_adl(the_alloc_method);
7049 template<typename T>
7050 inline void*alloc_method(type_info_t<T>)noexcept{
7051 //return空指针被允许,会引起gc_for_alloc
7052 if constexpr(was_not_an_ill_form(the_alloc_method(type_info<T>)))
7053 return the_alloc_method(type_info<T>);
7054 else
7055 return default_method::alloc_method(type_info<T>);
7056 }
7057 template<typename T>
7058 inline void*alloc_method(type_info_t<T>,size_t size)noexcept{
7059 //return空指针被允许,会引起gc_for_alloc
7060 //size被保证不为0
7061 if constexpr(was_not_an_ill_form(the_alloc_method(type_info<T>,size)))
7062 return the_alloc_method(type_info<T>,size);
7063 else
7064 return default_method::alloc_method(type_info<T>,size);
7065 }
7066 enable_adl(the_get_size_of_alloc_method);
7067 template<typename T>
7068 inline size_t get_size_of_alloc_method(const T*arg)noexcept{
7069 //arg保证不与null_ptr相等
7070 if constexpr(was_not_an_ill_form(the_get_size_of_alloc_method(arg)))
7071 return the_get_size_of_alloc_method(arg);
7072 else
7073 return default_method::get_size_of_alloc_method(arg);
7074 }
7075 enable_adl(the_free_method);
7076 template<typename T>
7077 inline void free_method(T*arg)noexcept{
7078 if constexpr(was_not_an_ill_form(the_free_method(arg)))
7079 the_free_method(arg);
7080 else
7081 default_method::free_method(arg);
7082 }
7083 enable_adl(the_realloc_method);
7084 template<typename T>
7085 inline void*realloc_method(T*&ptr,size_t new_size)noexcept{
7086 //return空指针被允许,会引起gc_for_alloc,但ptr值必须保持有效以保证gc_for_alloc后再次realloc有效
7087 //new_size被保证不为0
7088 //align维持不变
7089 //但只允许在扩大数据块时可选的移动数据块
7090 if constexpr(was_not_an_ill_form(the_realloc_method(ptr,new_size)))
7091 return the_realloc_method(ptr,new_size);
7092 else
7093 return default_method::realloc_method(ptr,new_size);
7094 }
7095
7096 //众所周知,cpp是面向对象语言.
7098 template<class T>
7100 typedef base_alloc_t base_t;
7101 [[nodiscard]]static T*base_call()noexcept{
7102 void*tmp;
7103 while(!assign(tmp,alloc_method(type_info<T>)))gc_for_alloc();
7104 return reinterpret_cast<T*>(tmp);
7105 }
7106 [[nodiscard]]static T*base_call(size_t size)noexcept{
7108 if constexpr(type_info<T>.has_attribute(never_in_array))
7109 template_error("You can\'t alloc an array for never_in_array type.");
7110 if(size){//null_ptr不一定等价于nullptr,请勿删除本行
7111 void*tmp;
7112 while(!assign(tmp,alloc_method(type_info<T>,size)))gc_for_alloc();
7113 return reinterpret_cast<T*>(tmp);
7114 }else return null_ptr;
7115 }
7116 [[nodiscard]]/*static*/force_inline T*operator()()const noexcept{return base_call();}
7117 [[nodiscard]]/*static*/force_inline T*operator()(size_t size)const noexcept{return base_call(size);}
7119 size_t _size;
7120 [[nodiscard]]force_inline T*operator()()const noexcept{return base_call(_size);}
7121 };
7122 [[nodiscard]]force_inline constexpr alloc_array_t operator[](size_t a)const noexcept{return{a};}
7123 };
7124 template<class T>
7125 constexpr alloc_t<T>alloc{};
7126
7127 constexpr struct free_t{
7128 typedef free_t base_t;
7129 template<class T>
7130 static void base_call(T*p)noexcept{
7132 if(p!=null_ptr)//null_ptr不一定等价于nullptr,请勿删除本行
7133 free_method(p);
7134 }
7135 template<class T>
7136 /*static*/force_inline void operator()(T*p)const noexcept{base_call(p);}
7137 }free{};
7138
7139 constexpr struct realloc_t{
7140 typedef realloc_t base_t;
7141 template<class T>
7142 static void base_call(T*&ptr,size_t nsize)noexcept{
7144 if constexpr(type_info<T>.has_attribute(never_in_array))
7145 template_error("You cannot perform array operations on never_in_array type.");
7146 //template_warning("For never_in_array type,realloc will free ptr when new_size=0 else do nothing.");
7147 if(nsize){//null_ptr不一定等价于nullptr,请勿删除本行
7148 if constexpr(type_info<T>.not_has_attribute(never_in_array))
7149 if(ptr!=null_ptr){//null_ptr不一定等价于nullptr,请勿删除本行
7150 while(!realloc_method(ptr,nsize))gc_for_alloc();
7151 }else
7152 ptr=alloc<T>(nsize);
7153 }else{
7154 free(ptr);
7155 ptr=null_ptr;
7156 }
7157 }
7158 template<class T>
7159 /*static*/force_inline void operator()(T*&ptr,size_t nsize)const noexcept{
7160 base_call(ptr,nsize);
7161 }
7163 size_t _size;
7164 template<class T>
7165 [[nodiscard]]force_inline T*operator()(T*&ptr)const noexcept{return base_call(ptr,_size);}
7166 };
7167 [[nodiscard]]force_inline constexpr realloc_array_t operator[](size_t a)const noexcept{return{a};}
7168 }realloc{};
7169
7170 constexpr struct get_size_of_alloc_t{
7171 template<typename T>
7172 static constexpr bool able=true;
7173 template<typename T>
7174 static constexpr bool nothrow=noexcept(get_size_of_alloc_method(declvalue(const T*)));
7175
7176 template<typename T> requires able<T>
7177 static size_t base_call(const T*arg)noexcept(nothrow<T>){
7179 if(arg==null_ptr)
7180 return 0;
7181 return get_size_of_alloc_method(arg);
7182 }
7183
7184 template<typename T> requires able<T>
7185 force_inline size_t operator()(const T*arg)const noexcept(nothrow<T>){
7186 return base_call(arg);
7187 }
7188 }get_size_of_alloc{};
7189
7190 constexpr struct copy_alloc_t{
7191 template<typename T>
7192 static constexpr bool able=true;
7193 template<typename T>
7194 static constexpr bool nothrow=get_size_of_alloc.nothrow<T>;
7195
7196 template<typename T> requires able<T>
7197 static T*base_call(const T*arg)noexcept(nothrow<T>){
7199 return alloc<T>(get_size_of_alloc(arg));
7200 }
7201
7202 template<typename T> requires able<T>
7203 force_inline T*operator()(const T*arg)const noexcept(nothrow<T>){
7204 return base_call(arg);
7205 }
7206 }copy_alloc{};
7207 }
7208
7209 //file_end
7210
7211 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/_body.hpp"
7212 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/_export.hpp"
7213 //_export.hpp
7214 //at namespace elc::defs::memory
7215 /*
7216 未完成的elc解释器base文件
7217 由steve02081504与Alex0125设计、编写
7218 转载时请在不对此文件做任何修改的同时注明出处
7219 项目地址:https://github.com/steve02081504/ELC
7220 */
7221 #define export using alloc_n::
7222 export alloc;
7223 export free;
7224 export realloc;
7225 export get_size_of_alloc;
7226 export copy_alloc;
7227 #undef export
7228
7229 //file_end
7230
7231 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/_body.hpp"
7232 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
7233 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/_test.hpp"
7234 //_test.hpp
7235 //at namespace elc::defs::memory
7236 /*
7237 未完成的elc解释器base文件
7238 由steve02081504与Alex0125设计、编写
7239 转载时请在不对此文件做任何修改的同时注明出处
7240 项目地址:https://github.com/steve02081504/ELC
7241 */
7242 inline void check_memory_lack()noexcept{
7243 stest_mapeventlogwith(lambda(const void*p,steventlist*a)noexcept{
7244 stest_putsf(L"内存泄露于%p,分配自:",p);
7245 stest_printeventlist(stdout,stest_copyeventlist(a));
7246 //alloc_n::base_free(remove_const(p));
7247 //stest_puts(L"已释放");
7248 stest_wait();
7249 });
7250 }
7251 #if defined(ELC_TEST_ON)
7252 namespace alloc_n{
7253 //BLOCK:for debug
7254 inline void test(){
7255 ELC_TEST_EVENTNAME("alloc部分测试");
7256 using ::std::time;
7257 using ::std::rand;
7258 using ::std::srand;
7259 srand((unsigned int)time(nullptr));
7260 for(int i=rand()%100+40;i--;){
7261 int*p=alloc<int>(50);
7262 p[0]=72;
7263 stest_accert(get_size_of_alloc(p)==50);
7264 p[49]=rand();
7265 p[19]=666;
7266 realloc(p,20);
7267 stest_accert(get_size_of_alloc(p)==20);
7268 stest_accert(p[19]==666);
7269 stest_accert(p[0]==72);
7270 free(p);
7271 }
7272 check_memory_lack();
7273 }
7274 inline void test_log_out(){
7275 }
7276 inline void test_end(){
7277 }
7278 //BLOCK_END
7279 }
7280 #endif
7281
7282 //file_end
7283
7284 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/alloc/_body.hpp"
7285 #endif
7286
7287 //file_end
7288
7289 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/_body.hpp"
7290 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/get/_body.hpp"
7291 //_body.hpp
7292 //at namespace elc::defs::memory
7293 /*
7294 未完成的elc解释器base文件
7295 由steve02081504与Alex0125设计、编写
7296 转载时请在不对此文件做任何修改的同时注明出处
7297 项目地址:https://github.com/steve02081504/ELC
7298 */
7299 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/get/defs.hpp"
7300 //defs.hpp
7301 //at namespace elc::defs::memory
7302 /*
7303 未完成的elc解释器base文件
7304 由steve02081504与Alex0125设计、编写
7305 转载时请在不对此文件做任何修改的同时注明出处
7306 项目地址:https://github.com/steve02081504/ELC
7307 */
7308 namespace abstract_base_n{
7309 /*
7310 ELC的虚基类模块,适用于unget
7311 处理虚基类到实例类的偏移与模板实例化差异
7312 原理:
7313 虚函数间接调用以从base_t&转为T&
7314 运行时计算偏移以从T*转换base_t*
7315 用法:is_common_attribute␁
7316 */
7317 common_attribute_t abstract_base;
7318 }
7319 namespace get_n{
7320 using abstract_base_n::abstract_base;
7321 //struct build_by_get_only{};已定义于 "../../base_defs/special_attribute.hpp"
7322
7323 /*向后减小数据块大小并转移原有实例的生命周期,但并不析构旧的实例*/
7324 template<typename T>
7325 void alloc_size_cut(T*&arg,size_t to_size)noexcept{
7326 realloc(arg,to_size);
7327 }
7328 /*向后扩大数据块大小并转移原有实例的生命周期,但并不构造新的实例*/
7329 template<typename T>
7330 void alloc_size_grow(T*&arg,size_t to_size)noexcept(move.trivial<T> or move.nothrow<T>){
7331 if constexpr(move.trivial<T>)
7332 realloc(arg,to_size);
7333 else{
7334 T*tmp=alloc<T>(to_size);
7335 auto from_size=get_size_of_alloc(arg);
7336 if constexpr(!move.nothrow<T>){
7337 template_warning("the move of T was not noexcept,this may cause memory lack.");
7338 try{
7339 move[from_size](note::from(arg),note::to(tmp));
7340 }catch(...){
7341 free(tmp);
7342 throw;
7343 }
7344 }else{
7345 move[from_size](note::from(arg),note::to(tmp));
7346 }
7347 free(arg);
7348 arg=tmp;
7349 }
7350 }
7351 /*在指定位置插入未初始化数据块并转移原有实例的生命周期,但并不构造新的实例*/
7352 template<typename T>
7353 void alloc_size_grow_with_insert_uninitialized_data(T*&arg,size_t insert_pos,size_t insert_size)noexcept(move.trivial<T> or move.nothrow<T>){
7354 const auto from_size=get_size_of_alloc(arg);
7355 const auto to_size=from_size+insert_size;
7356 const auto size_before_insert=insert_pos;
7357 const auto size_after_insert=from_size-insert_pos;
7358 if constexpr(move.trivial<T>){
7359 realloc(arg,to_size);
7360 memmove(arg+size_before_insert+insert_size,arg+size_before_insert,size_after_insert*sizeof(T));
7361 }
7362 else{
7363 T*tmp=alloc<T>(to_size);
7364 if constexpr(!move.nothrow<T>){
7365 template_warning("the move of T was not noexcept,this may cause memory lack.");
7366 try{
7367 move[size_before_insert](note::from(arg),note::to(tmp));
7368 move[size_after_insert](note::from(arg+insert_pos),note::to(tmp+insert_pos+insert_size));
7369 }catch(...){
7370 free(tmp);
7371 throw;
7372 }
7373 }else{
7374 move[size_before_insert](note::from(arg),note::to(tmp));
7375 move[size_after_insert](note::from(arg+insert_pos),note::to(tmp+insert_pos+insert_size));
7376 }
7377 free(arg);
7378 arg=tmp;
7379 }
7380 }
7381 /*
7382 在指定位置插入未初始化数据块并转移原有实例的生命周期,但并不构造新的实例
7383 若有多余的大小,追加到末尾
7384 返回多余的大小
7385 */
7386 template<typename T>
7387 size_t alloc_size_grow_with_insert_uninitialized_data(T*&arg,size_t to_size,size_t insert_pos,size_t insert_size)noexcept(move.trivial<T> or move.nothrow<T>){
7388 const auto from_size=get_size_of_alloc(arg);
7389 const auto size_before_insert=insert_pos;
7390 const auto size_after_insert=from_size-insert_pos;
7391 if constexpr(move.trivial<T>){
7392 realloc(arg,to_size);
7393 memmove(arg+size_before_insert+insert_size,arg+size_before_insert,size_after_insert*sizeof(T));
7394 }
7395 else{
7396 T*tmp=alloc<T>(to_size);
7397 if constexpr(!move.nothrow<T>){
7398 template_warning("the move of T was not noexcept,this may cause memory lack.");
7399 try{
7400 move[size_before_insert](note::from(arg),note::to(tmp));
7401 move[size_after_insert](note::from(arg+insert_pos),note::to(tmp+insert_pos+insert_size));
7402 }catch(...){
7403 free(tmp);
7404 throw;
7405 }
7406 }else{
7407 move[size_before_insert](note::from(arg),note::to(tmp));
7408 move[size_after_insert](note::from(arg+insert_pos),note::to(tmp+insert_pos+insert_size));
7409 }
7410 free(arg);
7411 arg=tmp;
7412 }
7413 return to_size-from_size-insert_size;
7414 }
7415 /*向前减小数据块大小并转移原有实例的生命周期,但并不析构旧的实例*/
7416 template<typename T>
7417 void forward_alloc_size_cut(T*&arg,size_t to_size)noexcept(move.trivial<T> or move.nothrow<T>){
7418 const auto from_size=get_size_of_alloc(arg);
7419 const auto cut_size=from_size-to_size;
7420 if constexpr(move.trivial<T>){
7421 ::std::memmove(arg,add_const(arg+cut_size),to_size*sizeof(T));
7422 realloc(arg,to_size);
7423 }
7424 else{
7425 T*tmp=alloc<T>(to_size);
7426 if constexpr(!move.nothrow<T>){
7427 template_warning("the move of T was not noexcept,this may cause memory lack.");
7428 try{
7429 move[to_size](note::from(arg+cut_size),note::to(tmp));
7430 }catch(...){
7431 free(tmp);
7432 throw;
7433 }
7434 }else{
7435 move[to_size](note::from(arg+cut_size),note::to(tmp));
7436 }
7437 free(arg);
7438 arg=tmp;
7439 }
7440 }
7441 /*向前扩大数据块大小并转移原有实例的生命周期,但并不构造新的实例*/
7442 template<typename T>
7443 void forward_alloc_size_grow(T*&arg,size_t to_size)noexcept(move.trivial<T> or move.nothrow<T>){
7444 const auto from_size=get_size_of_alloc(arg);
7445 const auto grow_size=to_size-from_size;
7446 if constexpr(move.trivial<T>){
7447 realloc(arg,to_size);
7448 ::std::memmove(arg+grow_size,add_const(arg),from_size*sizeof(T));
7449 }
7450 else{
7451 T*tmp=alloc<T>(to_size);
7452 if constexpr(!move.nothrow<T>){
7453 template_warning("the move of T was not noexcept,this may cause memory lack.");
7454 try{
7455 move[from_size](note::from(arg),note::to(tmp+grow_size));
7456 }catch(...){
7457 free(tmp);
7458 throw;
7459 }
7460 }else{
7461 move[from_size](note::from(arg),note::to(tmp+grow_size));
7462 }
7463 free(arg);
7464 arg=tmp;
7465 }
7466 }
7467 /*
7468 在指定位置插入未初始化数据块并转移原有实例的生命周期,但并不构造新的实例
7469 若有多余的大小,追加到前端
7470 返回多余的大小
7471 */
7472 template<typename T>
7473 size_t forward_alloc_size_grow_with_insert_uninitialized_data(T*&arg,size_t to_size,size_t insert_pos,size_t insert_size)noexcept(move.trivial<T> or move.nothrow<T>){
7474 const auto from_size=get_size_of_alloc(arg);
7475 const auto grow_size=to_size-from_size;
7476 const auto before_grow_size=grow_size-insert_size;
7477 const auto size_before_insert=insert_pos;
7478 const auto size_after_insert=from_size-insert_pos;
7479 if constexpr(move.trivial<T>){
7480 realloc(arg,to_size);
7481 const auto orogin_data_ptr=arg+before_grow_size;
7482 ::std::memmove(orogin_data_ptr+size_before_insert+insert_size,arg+size_before_insert,size_after_insert*sizeof(T));
7483 ::std::memmove(orogin_data_ptr,arg,size_before_insert*sizeof(T));
7484 }
7485 else{
7486 T*tmp=alloc<T>(to_size);
7487 if constexpr(!move.nothrow<T>){
7488 template_warning("the move of T was not noexcept,this may cause memory lack.");
7489 try{
7490 const auto orogin_data_ptr=tmp+before_grow_size;
7491 move[size_before_insert](note::from(arg),note::to(orogin_data_ptr));
7492 move[size_after_insert](note::from(arg+size_before_insert),note::to(orogin_data_ptr+size_before_insert+insert_size));
7493 }catch(...){
7494 free(tmp);
7495 throw;
7496 }
7497 }else{
7498 const auto orogin_data_ptr=tmp+before_grow_size;
7499 move[size_before_insert](note::from(arg),note::to(orogin_data_ptr));
7500 move[size_after_insert](note::from(arg+size_before_insert),note::to(orogin_data_ptr+size_before_insert+insert_size));
7501 }
7502 free(arg);
7503 arg=tmp;
7504 }
7505 return before_grow_size;
7506 }
7507
7508 struct base_get_t{};
7509 template<typename T>
7511 typedef base_get_t base_t;
7512 template<class...Args>
7513 static constexpr bool able=construct<T>.able<Args...>&&destruct.able<T>;
7514 template<class...Args>
7515 static constexpr bool nothrow=construct<T>.nothrow<Args...>;
7516
7517 template<class...Args> requires able<Args...>
7518 [[nodiscard]]T* operator()(Args&&...rest)const noexcept(nothrow<Args...>){
7520 return construct<T>[alloc<T>()](forward<Args>(rest)...);
7521 }
7522
7524 size_t _size;
7525 template<class...Args> requires able<Args...>
7526 [[nodiscard]]T* operator()(Args&&...rest)const noexcept(nothrow<Args...>){
7528 if constexpr(type_info<T>.has_attribute(never_in_array))
7529 template_error("You can\'t get an array for never_in_array type.");
7530 return construct<T>[alloc<T>(_size)][_size](forward<Args>(rest)...);
7531 }
7532 };
7533 [[nodiscard]]constexpr array_get_t operator[](size_t size)const noexcept{return{size};}
7534
7535 static constexpr struct as_array_t{
7536 template<typename U>
7537 static constexpr bool able=copy_construct.able<T>&&destruct.able<T>&&is_array_like_for<T,U>;
7538 template<typename U>
7539 static constexpr bool nothrow=copy_construct.nothrow<T>;
7540
7541 [[nodiscard]]T* operator()(array_like_view_t<const T>a)const noexcept(nothrow<void>){
7543 if constexpr(type_info<T>.has_attribute(never_in_array))
7544 template_error("You can\'t get an array for never_in_array type.");
7545 auto size=a.size();
7546 auto aret=alloc<T>[size]();
7547 copy_construct[size](note::from(a.begin()),note::to(aret));
7548 return aret;
7549 }
7550 }as_array{};
7551
7552 static constexpr struct apply_end_t{
7553 template<typename U>
7554 static constexpr bool able=copy_construct.able<T>&&move.able<T>&&is_array_like_for<T,U>;
7555 template<typename U>
7556 static constexpr bool nothrow=copy_construct.nothrow<T>&&move.nothrow<T>;
7557
7558 T* operator()(note::to_t<T*&> to,array_like_view_t<const T>a)const noexcept(nothrow<void>){
7560 auto&ptr=to.value;
7561 auto from_size=get_size_of_alloc(ptr);
7562 auto a_size=a.size();
7563 alloc_size_grow(ptr,from_size+a_size);
7564 copy_construct[a_size](note::from(a.begin()),note::to(ptr+from_size));
7565 return ptr;
7566 }
7567 T* operator()(note::to_t<T*&> to,const T&a)const noexcept(nothrow<void>){
7569 auto&ptr=to.value;
7570 auto from_size=get_size_of_alloc(ptr);
7571 alloc_size_grow(ptr,from_size+1);
7572 copy_construct(note::from(&a),note::to(ptr+from_size));
7573 return ptr;
7574 }
7575 T* operator()(note::to_t<T*&> to,T&&a)const noexcept(nothrow<void>){
7577 auto&ptr=to.value;
7578 auto from_size=get_size_of_alloc(ptr);
7579 alloc_size_grow(ptr,from_size+1);
7580 move_construct(note::from(&a),note::to(ptr+from_size));
7581 return ptr;
7582 }
7583 }apply_end{};
7584
7585 static constexpr struct remove_t{
7586 template<typename U>
7587 static constexpr bool able=destruct.able<T>&&move.able<T>&&is_array_like_for<T,U>;
7588 template<typename U>
7589 static constexpr bool nothrow=destruct.nothrow<T>&&move.nothrow<T>;
7590
7591 bool operator()(array_like_view_t<const T>a,note::from_t<T*>from)const noexcept(nothrow<void>){
7593 auto ptr=from.value;
7594 auto from_size=get_size_of_alloc(ptr);
7595 T*ptr_to_a=in_range(a,{ptr,note::size(from_size)});
7596 auto a_size=a.size();
7597 if(!ptr_to_a)
7598 return false;
7599
7600 destruct[a_size](ptr_to_a);
7601 move[(ptr+from_size)-(ptr_to_a+a_size)](note::from(ptr_to_a+a_size),note::to(ptr_to_a));
7602 alloc_size_cut(ptr,from_size-a_size);
7603 return true;
7604 }
7605 }remove{};
7606 };
7607 template<typename T>
7608 constexpr get_t<T>get{};
7609
7610
7611 constexpr struct unget_t{
7612 template<typename T>
7613 static constexpr bool able=destruct.able<T>;
7614 template<typename T>
7615 static constexpr bool nothrow=destruct.nothrow<T>;
7616
7617 template<typename T> requires able<T>
7618 void operator()(T*a)const noexcept(nothrow<T>){
7620 if(a!=null_ptr){
7621 if constexpr(type_info<T>.has_attribute(abstract_base))
7622 #if defined(_MSC_VER)
7623 [[gsl::suppress(f.6)]]
7624 #endif
7625 attribute_ptr_cast<abstract_base>(a)->abstract_method_unget_this();
7626 else{
7627 if constexpr(!destruct.nothrow<T>)
7628 template_warning("the destructer of T was not noexcept,this may cause memory lack.");
7629 if constexpr(type_info<T>.has_attribute(never_in_array))
7630 destruct(a);
7631 else
7632 destruct[get_size_of_alloc(a)](a);
7633 free(a);
7634 }
7635 }
7636 }
7637 /*适用于unget(this,not destruct);*/
7638 template<typename T> requires able<T>
7639 void operator()(T*a,decltype(destruct)::not_t)const noexcept(nothrow<T>){
7641 free(a);
7642 }
7643 }unget{};
7644
7645 constexpr struct get_resize_t{
7646 template<typename T>
7647 static constexpr bool able=construct<T>.able<>&&destruct.able<T>&&move.able<T>;
7648 template<typename T>
7649 static constexpr bool nothrow=type_info<T>.not_has_attribute(abstract_base)&&construct<T>.nothrow<>&&destruct.nothrow<T>&&move.nothrow<T>;
7650
7651 template<typename T> requires able<T>
7652 static void base_call(T*&arg,const size_t to_size)noexcept(nothrow<T>){
7653 if constexpr(type_info<T>.has_attribute(never_in_array)){
7654 template_warning("For never_in_array type,get_resize will unget ptr when new_size=0 else do nothing.");
7655 if(to_size)
7656 return;
7657 unget(arg);
7658 arg=null_ptr;
7659 }elseif constexpr(type_info<T>.has_attribute(abstract_base)){
7660 arg=attribute_ptr_cast<abstract_base>(arg)->abstract_method_get_resize_this(to_size);
7661 }else{
7662 const size_t from_size=get_size_of_alloc(arg);
7663 if(from_size==to_size)
7664 return;
7665 elseif(from_size > to_size){
7666 destruct[from_size-to_size](arg+to_size);
7667 alloc_size_cut(arg,to_size);
7668 }elseif(from_size){
7669 alloc_size_grow(arg,to_size);
7670 construct<T>[arg+from_size][to_size-from_size]();
7671 }else
7672 arg=get<T>[to_size]();
7673 }
7674 }
7675
7676 template<typename T> requires able<T>
7677 inline void operator()(T*&arg,size_t to_size)const noexcept(nothrow<T>){
7679 base_call(arg,to_size);
7680 }
7681 template<typename T> requires able<T>
7682 [[nodiscard]]inline T* operator()(T*&&arg,size_t to_size)const noexcept(nothrow<T>){
7684 base_call(arg,to_size);
7685 return arg;
7686 }
7687
7688 static constexpr struct insert_t{
7689 template<typename T>
7690 static constexpr bool able=get_resize_t::able<T>;
7691 template<typename T>
7692 static constexpr bool nothrow=get_resize_t::nothrow<T>;
7693 template<typename T> requires(able<T> && construct<T>.able<>)
7694 void operator()(T*&arg,size_t insert_pos,size_t insert_size)const noexcept(nothrow<T>){
7695 if(insert_size){
7697 alloc_size_grow_with_insert_uninitialized_data(arg,insert_pos,insert_size);
7698 construct<T>[arg+insert_pos][insert_size]();
7699 }
7700 }
7701 template<typename T> requires(able<T> && copy_construct.able<T>)
7702 void operator()(T*&arg,size_t insert_pos,size_t insert_size,const T*insert_data)const noexcept(nothrow<T>){
7703 if(insert_size){
7705 alloc_size_grow_with_insert_uninitialized_data(arg,insert_pos,insert_size);
7706 copy_construct[insert_size](note::from(insert_data),note::to(arg+insert_pos));
7707 }
7708 }
7709 }insert{};
7710 static constexpr struct insert_resize_t{
7711 template<typename T>
7712 static constexpr bool able=get_resize_t::able<T>;
7713 template<typename T>
7714 static constexpr bool nothrow=get_resize_t::nothrow<T>;
7715 template<typename T> requires(able<T> && construct<T>.able<> && copy_construct.able<T>)
7716 void operator()(T*&arg,size_t insert_pos,size_t insert_size,const T*insert_data,size_t to_size)const noexcept(nothrow<T>){
7718 auto end_grow_size=alloc_size_grow_with_insert_uninitialized_data(arg,to_size,insert_pos,insert_size);
7719 copy_construct[insert_size](note::from(insert_data),note::to(arg+insert_pos));
7720 construct<T>[arg+to_size-end_grow_size][end_grow_size]();
7721 }
7722 }insert_with_resize{};
7723 }get_resize{};
7724
7725 constexpr struct get_forward_resize_t{
7726 template<typename T>
7727 static constexpr bool able=construct<T>.able<>&&destruct.able<T>&&move.able<T>;
7728 template<typename T>
7729 static constexpr bool nothrow=type_info<T>.not_has_attribute(abstract_base)&&construct<T>.nothrow<>&&destruct.nothrow<T>&&move.nothrow<T>;
7730
7731 template<typename T> requires able<T>
7732 static void base_call(T*&arg,const size_t to_size)noexcept(nothrow<T>){
7734 if constexpr(type_info<T>.has_attribute(never_in_array)){
7735 template_warning("For never_in_array type,get_forward_resize will unget ptr when new_size=0 else do nothing.");
7736 if(to_size)
7737 return;
7738 unget(arg);
7739 arg=null_ptr;
7740 }elseif constexpr(type_info<T>.has_attribute(abstract_base)){
7741 arg=attribute_ptr_cast<abstract_base>(arg)->abstract_method_get_forward_resize_this(to_size);
7742 }else{
7743 const size_t from_size=get_size_of_alloc(arg);
7744 if(from_size==to_size)
7745 return;
7746 elseif(from_size > to_size){
7747 destruct[from_size-to_size](arg);
7748 forward_alloc_size_cut(arg,to_size);
7749 }elseif(from_size){
7750 forward_alloc_size_grow(arg,to_size);
7751 construct<T>[arg][to_size-from_size]();
7752 }else
7753 arg=get<T>[to_size]();
7754 }
7755 }
7756
7757 template<typename T> requires able<T>
7758 inline void operator()(T*&arg,size_t to_size)const noexcept(nothrow<T>){
7759 base_call(arg,to_size);
7760 }
7761 template<typename T> requires able<T>
7762 [[nodiscard]]inline T* operator()(T*&&arg,size_t to_size)const noexcept(nothrow<T>){
7763 base_call(arg,to_size);
7764 return arg;
7765 }
7766
7767 static constexpr struct insert_t{
7768 template<typename T>
7769 static constexpr bool able=get_resize_t::able<T>;
7770 template<typename T>
7771 static constexpr bool nothrow=get_resize_t::nothrow<T>;
7772 template<typename T> requires(able<T> && construct<T>.able<>)
7773 void operator()(T*&arg,size_t insert_pos,size_t insert_size)const noexcept(nothrow<T>){
7775 get_resize.insert(arg,insert_pos,insert_size);
7776 }
7777 template<typename T> requires(able<T> && copy_construct.able<T>)
7778 void operator()(T*&arg,size_t insert_pos,size_t insert_size,const T*insert_data)const noexcept(nothrow<T>){
7780 get_resize.insert(arg,insert_pos,insert_size,insert_data);
7781 }
7782 }insert{};
7783 static constexpr struct insert_resize_t{
7784 template<typename T>
7785 static constexpr bool able=get_resize_t::able<T>;
7786 template<typename T>
7787 static constexpr bool nothrow=get_resize_t::nothrow<T>;
7788 template<typename T> requires(able<T> && construct<T>.able<> && copy_construct.able<T>)
7789 void operator()(T*&arg,size_t insert_pos,size_t insert_size,const T*insert_data,size_t to_size)const noexcept(nothrow<T>){
7790 if(insert_size){
7792 auto before_grow_size=forward_alloc_size_grow_with_insert_uninitialized_data(arg,to_size,insert_pos,insert_size);
7793 const auto orogin_arg=arg+before_grow_size;
7794 copy_construct[insert_size](note::from(insert_data),note::to(orogin_arg+insert_pos));
7795 construct<T>[arg][before_grow_size]();
7796 }
7797 }
7798 }insert_with_resize{};
7799 }get_forward_resize{};
7800
7801 constexpr struct get_size_of_get_t{
7802 template<typename T>
7803 static constexpr bool able=true;
7804 template<typename T>
7805 static constexpr bool nothrow=noexcept(get_size_of_alloc(declvalue(const T*)));
7806
7807 template<typename T> requires able<T>
7808 static size_t base_call(const T*arg)noexcept(nothrow<T>){
7810 return get_size_of_alloc(arg);
7811 }
7812
7813 template<typename T> requires able<T>
7814 size_t operator()(const T*arg)const noexcept(nothrow<T>){
7815 return base_call(arg);
7816 }
7817 }get_size_of_get{};
7818
7819 constexpr struct copy_get_t{
7820 template<typename T>
7821 static constexpr bool able=copy_construct.able<T> || type_info<T>.has_attribute(abstract_base);
7822 template<typename T>
7823 static constexpr bool nothrow=copy_construct.nothrow<T>;
7824
7825 template<typename T> requires able<T>
7826 static T*base_call(const T*arg)noexcept(nothrow<T>){
7828 if constexpr(type_info<T>.has_attribute(abstract_base))
7829 return remove_const(attribute_ptr_cast<abstract_base>(arg))->abstract_method_copy_get_this();
7830 else
7831 return copy_construct(note::from(arg),note::to(copy_alloc(arg)),get_size_of_get(arg));
7832 }
7833
7834 template<typename T> requires able<T>
7835 T*operator()(const T*arg)const noexcept(nothrow<T>){
7836 return base_call(arg);
7837 }
7838 }copy_get{};
7839 }
7840
7841 //file_end
7842
7843 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/get/_body.hpp"
7844 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/get/_export.hpp"
7845 //_export.hpp
7846 //at namespace elc::defs::memory
7847 /*
7848 未完成的elc解释器base文件
7849 由steve02081504与Alex0125设计、编写
7850 转载时请在不对此文件做任何修改的同时注明出处
7851 项目地址:https://github.com/steve02081504/ELC
7852 */
7853 #define export using get_n::
7854 export get;
7855 export get_resize;
7856 export get_forward_resize;
7857 export unget;
7858 export get_size_of_get;
7859 export copy_get;
7860 //export build_by_get_only;
7861 #undef export
7862
7863 //file_end
7864
7865 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/get/_body.hpp"
7866 #if defined(ELC_TEST_ON)
7867 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/get/_test.hpp"
7868 //_test.hpp
7869 //at namespace elc::defs::memory
7870 /*
7871 未完成的elc解释器base文件
7872 由steve02081504与Alex0125设计、编写
7873 转载时请在不对此文件做任何修改的同时注明出处
7874 项目地址:https://github.com/steve02081504/ELC
7875 */
7876 namespace get_n{
7877 //BLOCK:for debug
7878 inline void test(){
7879 ELC_TEST_EVENTNAME("get部分测试");
7880 {
7881 ste::tester::setzero();
7882 tester*p=get<tester>[50]();
7883 stest_accert(tester::getbuildtime()==50);
7884 get_resize(p,60);
7885 //destroytime:50(+50) cause move(move_construct&destruct).
7886 stest_accert(tester::getdestroytime()==50);
7887 stest_accert(tester::getbuildtime()==60);
7888 int i=0;
7889 do
7890 p[i]();//写入测试
7891 while(++i!=60);
7892 stest_accert(tester::getcalltime()==60);
7893 unget(p);
7894 //destroytime:110(+60) cause destruct.
7895 stest_accert(tester::getdestroytime()==110);
7896 }
7897 check_memory_lack();
7898 }
7899 inline void test_log_out(){
7900 }
7901 inline void test_end(){
7902 }
7903 //BLOCK_END
7904 }
7905
7906 //file_end
7907
7908 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/get/_body.hpp"
7909 #endif
7910
7911 //file_end
7912
7913 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/_body.hpp"
7914 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/_body.hpp"
7915 //_body.hpp
7916 //at namespace elc::defs::memory
7917 /*
7918 未完成的elc解释器base文件
7919 由steve02081504与Alex0125设计、编写
7920 转载时请在不对此文件做任何修改的同时注明出处
7921 项目地址:https://github.com/steve02081504/ELC
7922 */
7923 //UF
7924 namespace abstract_base_n{
7925 /*
7926 ELC的虚基类模块,适用于unget
7927 处理虚基类到实例类的偏移与模板实例化差异
7928 原理:
7929 虚函数间接调用以从base_t&转为T&
7930 运行时计算偏移以从T*转换base_t*
7931 用法:is_common_attribute␁
7932 */
7933 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/pointer_off_set.hpp"
7934 //pointer_off_set.hpp
7935 //at namespace elc::defs::memory::abstract_base_n
7936 /*
7937 未完成的elc解释器base文件
7938 由steve02081504与Alex0125设计、编写
7939 转载时请在不对此文件做任何修改的同时注明出处
7940 项目地址:https://github.com/steve02081504/ELC
7941 */
7942 inline thread_local pointer base_ptr;
7943 inline thread_local ptrdiff_t off_set;
7944 distinctive inline void is_base_ptr(void*a)noexcept{base_ptr=a;}
7945 distinctive inline void is_instance_ptr(void*a)noexcept{off_set=get_off_set(note::from(a),note::to(base_ptr));}
7946 distinctive inline void*get_ptr_after_off_set(void*a)noexcept{return apply_off_set(a,off_set);}
7947
7948 //file_end
7949
7950 #line 19 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/_body.hpp"
7951 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/abstract_base_vtable.hpp"
7952 //abstract_base_vtable.hpp
7953 //at namespace elc::defs::memory::abstract_base_n
7954 /*
7955 未完成的elc解释器base文件
7956 由steve02081504与Alex0125设计、编写
7957 转载时请在不对此文件做任何修改的同时注明出处
7958 项目地址:https://github.com/steve02081504/ELC
7959 */
7960 no_vtable_class abstract_base_vtable{
7961 protected:
7962 virtual void* _abstract_method_copy_get_this()=0;
7963 virtual void* _abstract_method_get_resize_this(size_t size)=0;
7964 virtual void* _abstract_method_get_forward_resize_this(size_t size)=0;
7965
7966 virtual void abstract_method_unget_this()=0;
7967 virtual size_t abstract_method_get_size_of_get_for_this()noexcept=0;
7968
7969 friend class get_n::unget_t;
7970 friend class get_n::get_resize_t;
7971 friend class get_n::get_size_of_get_t;
7972 friend class get_n::copy_get_t;
7973 };
7974
7975 //file_end
7976
7977 #line 20 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/_body.hpp"
7978 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/abstract_base.hpp"
7979 //abstract_base.hpp
7980 //at namespace elc::defs::memory::abstract_base_n
7981 /*
7982 未完成的elc解释器base文件
7983 由steve02081504与Alex0125设计、编写
7984 转载时请在不对此文件做任何修改的同时注明出处
7985 项目地址:https://github.com/steve02081504/ELC
7986 */
7987 template<class T>
7988 no_vtable_class abstract_base:virtual public abstract_base_vtable{
7989 T* abstract_method_copy_get_this(){
7990 is_base_ptr(this);
7991 return reinterpret_cast<T*>(get_ptr_after_off_set(this->_abstract_method_copy_get_this()));
7992 }
7993 T* abstract_method_get_resize_this(size_t size){
7994 is_base_ptr(this);
7995 return reinterpret_cast<T*>(get_ptr_after_off_set(this->_abstract_method_get_resize_this(size)));
7996 }
7997 T* abstract_method_get_forward_resize_this(size_t size){
7998 is_base_ptr(this);
7999 return reinterpret_cast<T*>(get_ptr_after_off_set(this->_abstract_method_get_forward_resize_this(size)));
8000 }
8001
8002 friend class get_n::unget_t;
8003 friend class get_n::get_resize_t;
8004 friend class get_n::get_size_of_get_t;
8005 friend class get_n::copy_get_t;
8006 };
8007
8008 //file_end
8009
8010 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/_body.hpp"
8011 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/instance_struct.hpp"
8012 //instance_struct.hpp
8013 //at namespace elc::defs::memory::abstract_base_n
8014 /*
8015 未完成的elc解释器base文件
8016 由steve02081504与Alex0125设计、编写
8017 转载时请在不对此文件做任何修改的同时注明出处
8018 项目地址:https://github.com/steve02081504/ELC
8019 */
8020 push_and_disable_msvc_warning(26436);//无虚析构函数警告diss
8021 template<class T>
8022 class instance_struct:is_common_attribute(instance_struct),virtual public abstract_base_vtable{
8023 protected:
8024 virtual void abstract_method_unget_this()noexcept_as(unget(get_handle(this)))override{unget(get_handle(this));}
8025 virtual void* _abstract_method_copy_get_this()noexcept(copy_get.able<T>?copy_get.nothrow<T>:1)override{
8026 if constexpr(copy_get.able<T>){
8027 is_instance_ptr(this);
8028 return copy_get(get_handle(this));
8029 }
8030 else{
8031 return get_handle(this);
8032 }
8033 }
8034 virtual void* _abstract_method_get_resize_this(size_t size)noexcept(get_resize.able<T>?get_resize.nothrow<T>:1)override{
8035 if constexpr(get_resize.able<T>){
8036 is_instance_ptr(this);
8037 return get_resize(get_handle(this),size);
8038 }
8039 else{
8040 return get_handle(this);
8041 }
8042 }
8043 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept(get_forward_resize.able<T>?get_forward_resize.nothrow<T>:1)override{
8044 if constexpr(get_forward_resize.able<T>){
8045 is_instance_ptr(this);
8046 return get_forward_resize(get_handle(this),size);
8047 }
8048 else{
8049 return get_handle(this);
8050 }
8051 }
8052 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return get_size_of_get(get_handle(this));}
8053 };
8054 pop_msvc_warning();
8055
8056 //file_end
8057
8058 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/_body.hpp"
8059 }
8060 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/_export.hpp"
8061 //_export.hpp
8062 //at namespace elc::defs::memory
8063 /*
8064 未完成的elc解释器base文件
8065 由steve02081504与Alex0125设计、编写
8066 转载时请在不对此文件做任何修改的同时注明出处
8067 项目地址:https://github.com/steve02081504/ELC
8068 */
8069 #define export using abstract_base_n::
8070 export abstract_base;
8071 export instance_struct;
8072 #undef export
8073
8074 //file_end
8075
8076 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/abstract_base/_body.hpp"
8077
8078 //file_end
8079
8080 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/_body.hpp"
8081
8082 //#include "pool/_body.hpp"//依赖list
8083
8084 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/_body.hpp"
8085 //_body.hpp
8086 //at namespace elc::defs::memory
8087 /*
8088 未完成的elc解释器base文件
8089 由steve02081504与Alex0125设计、编写
8090 转载时请在不对此文件做任何修改的同时注明出处
8091 项目地址:https://github.com/steve02081504/ELC
8092 */
8093 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/defs.hpp"
8094 //defs.hpp
8095 //at namespace elc::defs::memory
8096 /*
8097 未完成的elc解释器base文件
8098 由steve02081504与Alex0125设计、编写
8099 转载时请在不对此文件做任何修改的同时注明出处
8100 项目地址:https://github.com/steve02081504/ELC
8101 */
8102 template<typename T>
8103 struct replace_able;
8104 namespace ptr_n{
8105 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/_body.hpp"
8106 //_body.hpp
8107 //at namespace elc::defs::memory::ptr_n
8108 /*
8109 未完成的elc解释器base文件
8110 由steve02081504与Alex0125设计、编写
8111 转载时请在不对此文件做任何修改的同时注明出处
8112 项目地址:https://github.com/steve02081504/ELC
8113 */
8114 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/ref_t.hpp"
8115 //ref_t.hpp
8116 //at namespace elc::defs::memory::ptr_n
8117 /*
8118 未完成的elc解释器base文件
8119 由steve02081504与Alex0125设计、编写
8120 转载时请在不对此文件做任何修改的同时注明出处
8121 项目地址:https://github.com/steve02081504/ELC
8122 */
8123 typedef ::std::size_t link_num_t;
8125 mutable link_num_t _ref_num=0;
8126 public:
8127 constexpr ref_t()noexcept=default;
8128 constexpr explicit ref_t(never_ref_num_zero_t)noexcept:_ref_num(1){}
8129 constexpr inline void add_ref()const noexcept{_ref_num++;}
8130 [[nodiscard]]inline bool cut_ref()const noexcept{return!--_ref_num;}
8131 //[[nodiscard]]operator bool()const noexcept{return _ref_num;}
8132 inline void set_zero()noexcept{_ref_num=0;}
8133 constexpr inline void init_never_ref_num_zero()noexcept{add_ref();}
8134 [[nodiscard]]link_num_t link_num()const noexcept{return _ref_num;}
8135 };
8136
8137 //file_end
8138
8139 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/_body.hpp"
8140 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/ref_base.hpp"
8141 //ref_base.hpp
8142 //at namespace elc::defs::memory::ptr_n
8143 /*
8144 未完成的elc解释器base文件
8145 由steve02081504与Alex0125设计、编写
8146 转载时请在不对此文件做任何修改的同时注明出处
8147 项目地址:https://github.com/steve02081504/ELC
8148 */
8149 enable_adl(the_waiting_for_destroy);
8150 template<typename T>
8151 void waiting_for_destroy(T*a)noexcept{
8152 if constexpr(was_not_an_ill_form(the_waiting_for_destroy(a)))
8153 return the_waiting_for_destroy(a);
8154 else
8155 template_error("this function should not be instantiated,please overload the function the_waiting_for_destroy in the namespace where this type is defined.");
8156 }
8157 enable_adl(the_destroy_and_free);
8158 template<typename T>
8159 void destroy_and_free(T*a)noexcept{
8160 if constexpr(was_not_an_ill_form(the_destroy_and_free(a)))
8161 return the_destroy_and_free(a);
8162 elseif constexpr(type_info<T>.has_attribute(build_by_get_only)&&type_info<T>.has_attribute(never_in_array))
8163 unget(a);
8164 else
8165 template_error("please overload the function the_destroy_and_free in the namespace where this type is defined.");
8166 }
8167 //
8168 common_attribute_t ref_able;
8169 common_attribute_t weak_ref_able;
8170
8171 template<typename T>
8172 constexpr bool was_ref_able=type_info<T>.has_attribute(ref_able);
8173 template<typename T>
8174 constexpr bool was_weak_ref_able=type_info<T>.has_attribute(weak_ref_able);
8175
8176 template<typename T>
8177 [[nodiscard]]link_num_t get_ref_num(const T*a)noexcept{
8178 if constexpr(!was_ref_able<T>)
8179 template_error("hey.");
8180 return attribute_ptr_cast<const ref_able>(a)->link_num();
8181 }
8182 template<typename T>
8183 [[nodiscard]]link_num_t get_weak_ref_num(const T*a)noexcept{
8184 if constexpr(!was_weak_ref_able<T>)
8185 template_error("hey.");
8186 return attribute_ptr_cast<const weak_ref_able>(a)->link_num();
8187 }
8188
8189 //file_end
8190
8191 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/_body.hpp"
8192 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/ref_able.hpp"
8193 //ref_able.hpp
8194 //at namespace elc::defs::memory::ptr_n
8195 /*
8196 未完成的elc解释器base文件
8197 由steve02081504与Alex0125设计、编写
8198 转载时请在不对此文件做任何修改的同时注明出处
8199 项目地址:https://github.com/steve02081504/ELC
8200 */
8201 template<typename T>
8202 struct ref_able:ref_t,can_t_use_default_null_ptr,is_common_attribute(ref_able){
8203 private:
8204 typedef ref_t base_t;
8205 public:
8206 using base_t::base_t;
8207 inline void cut_ref()const noexcept{
8208 T*this_T=remove_const(get_handle(this));
8209 if(base_t::cut_ref())
8210 if constexpr(was_weak_ref_able<T>)
8211 if(get_weak_ref_num(this_T)!=0)
8212 waiting_for_destroy(this_T);
8213 else
8214 destroy_and_free(this_T);
8215 else
8216 destroy_and_free(this_T);
8217 }
8218 };
8219
8220 //file_end
8221
8222 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/_body.hpp"
8223 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/weak_ref_able.hpp"
8224 //weak_ref_able.hpp
8225 //at namespace elc::defs::memory::ptr_n
8226 /*
8227 未完成的elc解释器base文件
8228 由steve02081504与Alex0125设计、编写
8229 转载时请在不对此文件做任何修改的同时注明出处
8230 项目地址:https://github.com/steve02081504/ELC
8231 */
8232 template<typename T>
8233 struct weak_ref_able:ref_t,can_t_use_default_null_ptr,is_common_attribute(weak_ref_able){
8234 private:
8235 typedef ref_t base_t;
8236 public:
8237 inline void cut_ref()const noexcept{
8238 if constexpr(!was_ref_able<T>)
8239 template_error("base on ref_able before base on weak_ref_able,please.");
8240 T*this_T=remove_const(get_handle(this));
8241 if(base_t::cut_ref())
8242 if(get_ref_num(this_T)==0)
8243 destroy_and_free(this_T);
8244 }
8245 };
8246
8247 //file_end
8248
8249 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ref/_body.hpp"
8250
8251 //file_end
8252
8253 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/defs.hpp"
8254 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/_body.hpp"
8255 //_body.hpp
8256 //at namespace elc::defs::memory::ptr_n
8257 /*
8258 未完成的elc解释器base文件
8259 由steve02081504与Alex0125设计、编写
8260 转载时请在不对此文件做任何修改的同时注明出处
8261 项目地址:https://github.com/steve02081504/ELC
8262 */
8263 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/base_ptr_t.hpp"
8264 //base_ptr_t.hpp
8265 //at namespace elc::defs::memory::ptr_n
8266 /*
8267 未完成的elc解释器base文件
8268 由steve02081504与Alex0125设计、编写
8269 转载时请在不对此文件做任何修改的同时注明出处
8270 项目地址:https://github.com/steve02081504/ELC
8271 */
8272 //copy from old ELC & adepted.
8273 template<class T>
8275 protected:
8276 mutable T*_to;
8277 explicit same_ptr_p_t(T*a)noexcept:_to(a){}
8278 public:
8279 same_ptr_p_t(const same_ptr_p_t&)noexcept=default;
8280 [[nodiscard]]T*get()const noexcept{return _to;}
8281 };
8282 template<class T,typename ref_type>
8284 using same_ptr_p_t<T>::_to;
8285 explicit same_ref_p_t(T*a)noexcept:same_ptr_p_t<T>(a){}
8286 explicit same_ref_p_t(const same_ptr_p_t<T>&a)noexcept:same_ptr_p_t<T>(a){}
8287
8288 void swap_with(same_ref_p_t&a)noexcept{swap(_to,a._to);}
8289
8290 static constexpr bool cut_nothrow=noexcept(declvalue(ref_type).cut_ref());
8291 protected:
8292 static void cut_ref(T*a)noexcept(cut_nothrow){attribute_ptr_cast<ref_type>(a)->cut_ref();}
8293 static void add_ref(T*a)noexcept{attribute_ptr_cast<ref_type>(a)->add_ref();}
8294
8295 void cut_ref()const noexcept_as(cut_ref(nullptr)){cut_ref(_to);}
8296 void add_ref()const noexcept{add_ref(_to);}
8297 };
8298
8299 template<class T,typename ref_type>
8300 inline void swap(same_ref_p_t<T,ref_type>&a,same_ref_p_t<T,ref_type>&b)noexcept{
8301 a.swap_with(b);
8302 }
8303
8304 template<class T,typename ref_type,bool do_replace_check>
8305 struct ptr_t:same_ref_p_t<T,ref_type>{
8307
8311 using base_t::cut_nothrow;
8312 using same_ref::add_ref;
8313 using same_ref::cut_ref;
8314 using same_ref::swap_with;
8315 using same_ptr::_to;
8316
8317 explicit ptr_t(T*a,special_init_t)noexcept:same_ref(a){}
8318 constexpr ptr_t(T*a)noexcept:same_ref(a){add_ref();}
8319 ptr_t(const same_ptr&a)noexcept:same_ref(a){
8320 if constexpr(type_info<T>.has_attribute(weak_ref_able) && type_info<ref_type> == type_info<ref_able<remove_cv<T>>>)
8321 if(get_ref_num(_to))
8322 add_ref();
8323 else
8324 add_ref(_to=null_ptr);
8325 else
8326 add_ref();
8327 }
8328 ptr_t(const same_ref&a)noexcept:same_ref(a){add_ref();}
8329 ptr_t(const ptr_t&a)noexcept:ptr_t((same_ptr&)a){}
8330 ptr_t(const ptr_t<remove_cv<T>,ref_type,do_replace_check>&a)noexcept requires(type_info<remove_cv<T>>!=type_info<T>):ptr_t(a.get()){}
8331 ptr_t(ptr_t&&a)noexcept:ptr_t((same_ptr&)a){
8332 //为什么不默认构造后swap_with?
8333 /*
8334 直接构造:
8335 对目标进行addref
8336 移动对象析构(单次cutref)
8337 总耗费4
8338 默认构造后swap_with:
8339 对nullptr进行addref
8340 交换ptr值
8341 移动对象析构(单次cutref)
8342 总耗费6
8343
8344 总结:多此一举
8345 */
8346 }
8347 constexpr ptr_t(nullptr_t=nullptr)noexcept:ptr_t(null_ptr){}
8348 constexpr ptr_t(null_ptr_t)noexcept:ptr_t((T*)(null_ptr)){}
8349 ~ptr_t()noexcept(cut_nothrow){cut_ref();}
8350
8351 static constexpr bool reset_nothrow=cut_nothrow;
8352 void reset(T*a)const noexcept(reset_nothrow){auto tmp=_to;add_ref(_to=a);cut_ref(tmp);}
8353 void reset(nullptr_t=nullptr)const noexcept(reset_nothrow){reset(null_ptr);}
8354 public:
8355 static constexpr bool replace_check_nothrow=(type_info<T>.not_has_attribute(replace_able))||reset_nothrow;
8356 inline void replace_check()const noexcept(replace_check_nothrow){
8357 if constexpr(do_replace_check&&type_info<remove_cvref<T>>.has_attribute(replace_able))
8358 if(attribute_ptr_cast<replace_able>(_to)->replaced())
8359 reset(attribute_ptr_cast<replace_able>(_to)->get_ptr());
8360 }
8361 inline void do_replace(T*p)noexcept(replace_check_nothrow&&reset_nothrow){
8362 if constexpr(type_info<remove_cvref<T>>.has_attribute(replace_able)){
8363 attribute_ptr_cast<replace_able>(_to)->be_replace_as(p);
8364 reset(p);
8365 }
8366 }
8367 template<typename ref_type_,bool do_replace_check_>
8368 inline void do_replace(const ptr_t<T,ref_type_,do_replace_check_>&p)noexcept(replace_check_nothrow&&reset_nothrow){
8369 do_replace(p.get());
8370 }
8371 static constexpr bool get_nothrow=replace_check_nothrow;
8372 [[nodiscard]]T*get()const noexcept(get_nothrow){
8373 replace_check();
8374 return base_t::get();
8375 }
8376 [[nodiscard]]bool unique()const noexcept{return attribute_ptr_cast<ref_able>(get())->link_num()==1;}
8377 [[nodiscard]]constexpr
8378 conditional<do_replace_check&&type_info<T>.has_attribute(replace_able),
8379 unstable_hash_t,hash_t> hash()const noexcept_as(elc::defs::hash(get())){//注意:当T可replace时,同一ptr的hash可能变动
8380 using elc::defs::hash;
8381 return hash(get());
8382 }
8383
8384 [[nodiscard]]inline auto operator==(const T*a)const noexcept_as(pointer_equal(add_const(declvalue(const this_t&).get()),a)){
8385 return pointer_equal(add_const(get()),a);
8386 }
8387 [[nodiscard]]inline auto operator==(nullptr_t)const noexcept_as(operator==(null_ptr)){
8388 return operator==(null_ptr);
8389 }
8390 [[nodiscard]]inline auto operator==(null_ptr_t)const noexcept_as(operator==((T*)null_ptr)){
8391 return operator==((T*)null_ptr);
8392 }
8393 template<typename ref_type_,bool do_replace_check_>
8394 [[nodiscard]]inline auto operator==(const ptr_t<T,ref_type_,do_replace_check_>&b)const
8395 noexcept_as(pointer_equal(
8396 declvalue(const this_t&).get(),
8397 b.get())
8398 ){
8399 return pointer_equal(get(),b.get());
8400 }
8401 template<typename ref_type_,bool do_replace_check_> requires(type_info<remove_cv<T>>!=type_info<T>)
8402 [[nodiscard]]inline auto operator==(const ptr_t<const T,ref_type_,do_replace_check_>&b)const
8403 noexcept_as(pointer_equal(
8404 declvalue(const this_t&).get(),
8405 b.get())
8406 ){
8407 return pointer_equal(get(),b.get());
8408 }
8409 template<typename ref_type_,bool do_replace_check_> requires(type_info<remove_cv<T>>!=type_info<T>)
8410 [[nodiscard]]inline auto operator==(const ptr_t<remove_cv<T>,ref_type_,do_replace_check_>&b)const
8411 noexcept_as(pointer_equal(
8412 declvalue(const this_t&).get(),
8413 add_const(b.get()))
8414 ){
8415 return pointer_equal(get(),add_const(b.get()));
8416 }
8417 };
8418
8419 template<typename T_,typename T,typename ref_type,bool do_replace_check,enable_if(type_info<T_>.base_on<T>)>
8420 [[nodiscard]]inline auto operator==(const T_*a,ptr_t<T,ref_type,do_replace_check>&b)noexcept_as(b.operator==(static_cast<const T*>(a))){
8421 return b.operator==(static_cast<const T*>(a));
8422 }
8423
8424 template<typename T,typename T_> requires(equal.able<T,T_>)
8425 [[nodiscard]]inline auto operator!=(T&&a,T_&&b)noexcept_as(!(a==b)){
8426 return !(a==b);
8427 }
8428
8429 template<class T,typename ref_type,bool do_replace_check>
8430 struct base_ptr_t:ptr_t<T,ref_type,do_replace_check>{
8431 static_assert(type_info<T>.base_on<ref_type>);
8434 using typename base_t::same_ref;
8435 using typename base_t::same_ptr;
8436 using base_t::reset;
8437 using base_t::get;
8438 using same_ref::swap_with;
8439 using same_ptr::_to;
8440
8441 using base_t::get_nothrow;
8442 using base_t::reset_nothrow;
8443
8444 using base_t::base_t;
8445
8446 base_ptr_t(base_ptr_t&a)noexcept:base_t(a){}
8447 base_ptr_t(base_ptr_t&&a)noexcept:base_t(move(a)){}
8448
8449 [[nodiscard]]T*operator->()const noexcept(get_nothrow){return get();}
8450 [[nodiscard]]T&operator*()const noexcept(get_nothrow){return*get();}
8451 [[nodiscard]]explicit operator bool()const noexcept(get_nothrow){return bool(pointer_to_bool(get()));}
8452 [[nodiscard]]auto operator!()const noexcept(get_nothrow){return!pointer_to_bool(get());}
8453 [[nodiscard]]explicit operator T*()const noexcept(get_nothrow){return get();}
8454
8455 base_ptr_t&operator=(T*a)&noexcept(reset_nothrow){reset(a);return*this;}
8456 base_ptr_t&operator=(const same_ptr&a)&noexcept(reset_nothrow&&get_nothrow){reset(a.get());return*this;}
8457 base_ptr_t&operator=(const base_ptr_t&a)&noexcept(reset_nothrow&&get_nothrow){reset(a.get());return*this;}
8458 base_ptr_t&operator=(same_ref&&a)&noexcept{swap_with(a);return*this;}
8459 base_ptr_t&operator=(base_ptr_t&&a)&noexcept{swap_with(a);return*this;}
8460 base_ptr_t&operator=(null_ptr_t)&noexcept(reset_nothrow){return*this=(T*)null_ptr;}
8461 base_ptr_t&operator=(nullptr_t)&noexcept(reset_nothrow){return*this=null_ptr;}
8462
8463 private:
8464 static inline thread_local class for_delete_t{
8465 T*_m;
8466 friend class this_t;
8467 for_delete_t*operator()(T*a)noexcept{
8468 _m=a;
8469 return this;
8470 }
8471 public:
8472 static void operator delete(void*a)noexcept_as(destroy(declvalue(T*))){
8473 destroy(reinterpret_cast<for_delete_t*>(a)->_m);
8474 }
8475 }for_delete{};
8476 public:
8477 [[nodiscard]]explicit operator bool()noexcept(get_nothrow){return add_const(this)->operator bool();}
8478 [[nodiscard]]distinctive operator for_delete_t*()noexcept(get_nothrow){return for_delete(get());}
8479
8480 template<typename...Args> requires(invoke<T>.able<Args...>)
8481 inline auto operator()(Args&&... rest)noexcept(invoke<T>.nothrow<Args...>){return(operator*())(forward<Args>(rest)...);}
8482 };
8483
8484 //file_end
8485
8486 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/_body.hpp"
8487 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/comn_ptr_t.hpp"
8488 //comn_ptr_t.hpp
8489 //at namespace elc::defs::memory::ptr_n
8490 /*
8491 未完成的elc解释器base文件
8492 由steve02081504与Alex0125设计、编写
8493 转载时请在不对此文件做任何修改的同时注明出处
8494 项目地址:https://github.com/steve02081504/ELC
8495 */
8496 template<typename T>
8498
8499 //file_end
8500
8501 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/_body.hpp"
8502 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/weak_ptr_t.hpp"
8503 //weak_ptr_t.hpp
8504 //at namespace elc::defs::memory::ptr_n
8505 /*
8506 未完成的elc解释器base文件
8507 由steve02081504与Alex0125设计、编写
8508 转载时请在不对此文件做任何修改的同时注明出处
8509 项目地址:https://github.com/steve02081504/ELC
8510 */
8511 template<typename T>
8513
8514 //file_end
8515
8516 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/_body.hpp"
8517 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/nocheck_ptr_t.hpp"
8518 //nocheck_ptr_t.hpp
8519 //at namespace elc::defs::memory::ptr_n
8520 /*
8521 未完成的elc解释器base文件
8522 由steve02081504与Alex0125设计、编写
8523 转载时请在不对此文件做任何修改的同时注明出处
8524 项目地址:https://github.com/steve02081504/ELC
8525 */
8526 template<typename T>
8528
8529 //file_end
8530
8531 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/_body.hpp"
8532 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/deduction_guides.hpp"
8533 //deduction_guides.hpp
8534 //at namespace elc::defs::memory::ptr_n
8535 /*
8536 未完成的elc解释器base文件
8537 由steve02081504与Alex0125设计、编写
8538 转载时请在不对此文件做任何修改的同时注明出处
8539 项目地址:https://github.com/steve02081504/ELC
8540 */
8541 template<class T,common_attribute_t ref_type,bool has_check>
8542 base_ptr_t(T*) -> base_ptr_t<remove_cvref<T>,ref_type<remove_cvref<T>>,has_check>;
8543
8544 template<class T,common_attribute_t ref_type,bool has_check>
8546
8547 //file_end
8548
8549 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/ptr/_body.hpp"
8550
8551 //file_end
8552
8553 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/defs.hpp"
8554 }
8555
8556 //file_end
8557
8558 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/_body.hpp"
8559 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/_export.hpp"
8560 //_export.hpp
8561 //at namespace elc
8562 /*
8563 未完成的elc解释器base文件
8564 由steve02081504与Alex0125设计、编写
8565 转载时请在不对此文件做任何修改的同时注明出处
8566 项目地址:https://github.com/steve02081504/ELC
8567 */
8568 #define export using ptr_n::
8569 export ref_able;
8570 export weak_ref_able;
8571 export base_ptr_t;
8572 export comn_ptr_t;
8573 export weak_ptr_t;
8574 #undef export
8575
8576 //file_end
8577
8578 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/_body.hpp"
8579 #if defined(ELC_TEST_ON)
8580 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/_test.hpp"
8581 //_test.hpp
8582 //at namespace elc::defs::memory::ptr_n
8583 /*
8584 未完成的elc解释器base文件
8585 由steve02081504与Alex0125设计、编写
8586 转载时请在不对此文件做任何修改的同时注明出处
8587 项目地址:https://github.com/steve02081504/ELC
8588 */
8589 namespace ptr_n{
8590 struct tester:type_info_t<tester>::template_name
8591 with_common_attribute<ref_able,weak_ref_able,never_in_array>,build_by_get_only{};
8592 void waiting_for_destroy(tester*)noexcept{}
8593 inline void test(){
8594 ELC_TEST_EVENTNAME("ptr部分测试");
8595 {
8596 comn_ptr_t a=get<tester>();
8597 weak_ptr_t b=a;
8598 }
8599 check_memory_lack();
8600 }
8601 inline void test_log_out(){
8602 }
8603 inline void test_end(){
8604 }
8605 }
8606
8607 //file_end
8608
8609 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/ptr/_body.hpp"
8610 #endif
8611
8612 //file_end
8613
8614 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/_body.hpp"
8615 //依赖list
8616 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/other/_body.hpp"
8617 //_body.hpp
8618 //at namespace elc::defs::memory
8619 /*
8620 未完成的elc解释器base文件
8621 由steve02081504与Alex0125设计、编写
8622 转载时请在不对此文件做任何修改的同时注明出处
8623 项目地址:https://github.com/steve02081504/ELC
8624 */
8625 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/other/replace_able.hpp"
8626 //replace_able.hpp
8627 //at namespace elc::defs::memory
8628 /*
8629 未完成的elc解释器base文件
8630 由steve02081504与Alex0125设计、编写
8631 转载时请在不对此文件做任何修改的同时注明出处
8632 项目地址:https://github.com/steve02081504/ELC
8633 */
8634 //此属性配合 "../ptr" 食用
8635 template<typename T>
8636 struct replace_able:non_copyable,non_moveable,is_common_attribute(replace_able){
8637 private:
8638 mutable T*_m;
8639 public:
8640 constexpr replace_able()noexcept:_m(get_handle(this)){}
8641 constexpr ~replace_able()noexcept{
8642 if(replaced())
8643 attribute_ptr_cast<ref_able>(_m)->cut_ref();
8644 }
8645 constexpr bool replaced()const noexcept{return _m!=get_handle(this);}
8646 constexpr T*get_ptr()const noexcept{
8647 if(!replaced())
8648 return _m;
8649 else
8650 return attribute_ptr_cast<replace_able>(_m)->get_ptr();
8651 }
8652 constexpr void be_replace_as(T*new_p)noexcept{
8653 if(replaced())
8654 attribute_ptr_cast<ref_able>(_m)->cut_ref();
8655 _m=new_p;
8656 if(replaced())
8657 attribute_ptr_cast<ref_able>(_m)->add_ref();
8658 }
8659 constexpr void be_replace_as(nullptr_t)noexcept{be_replace_as(null_ptr);}
8660 };
8661
8662 //file_end
8663
8664 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/other/_body.hpp"
8665 //依赖list
8666 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/other/can_map_all.hpp"
8667 //can_map_all.hpp
8668 //at namespace elc::defs::memory
8669 /*
8670 未完成的elc解释器base文件
8671 由steve02081504与Alex0125设计、编写
8672 转载时请在不对此文件做任何修改的同时注明出处
8673 项目地址:https://github.com/steve02081504/ELC
8674 */
8675 template<typename T>
8676 struct can_map_all:cons_t<can_map_all<T>>,is_common_attribute(can_map_all){
8677 typedef can_map_all<T> this_t;
8678 private:
8679 distinctive inline static list_t<this_t> type_list;
8680
8681 template<class,class func_t>
8682 friend inline void map_all_helper(func_t&&a);
8683 public:
8684 constexpr can_map_all(){
8685 type_list.add(this);
8686 }
8687 };
8688 template<class T,class func_t>
8689 inline void map_all_helper(func_t&&a){
8690 auto tmp=can_map_all<T>::type_list.begin();
8691 auto end=can_map_all<T>::type_list.end();
8692 while(tmp!=end){
8693 a(get_handle<T,can_map_all>(tmp++));
8694 }
8695 }
8696 #define expr declvalue(func_t)(declvalue(T*))
8697 template<class T,class func_t,enable_if(was_not_an_ill_form(expr))>
8698 inline void map_all(func_t&&a)noexcept_as(expr){
8699 map_all_helper<T,func_t>(forward<func_t>(a));
8700 }
8701 #undef expr
8702
8703 //file_end
8704
8705 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/other/_body.hpp"
8706
8707 //file_end
8708
8709 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/_body.hpp"
8710
8711 //#include "gc/_body.hpp"//NOTE:gc不在此处定义,因为它依赖container
8712
8713 #if defined(ELC_TEST_ON)
8714 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/_test.hpp"
8715 //_test.hpp
8716 //at namespace elc::defs::memory
8717 /*
8718 未完成的elc解释器base文件
8719 由steve02081504与Alex0125设计、编写
8720 转载时请在不对此文件做任何修改的同时注明出处
8721 项目地址:https://github.com/steve02081504/ELC
8722 */
8723 inline void test(){
8724 ELC_TEST_EVENTNAME("memory部分测试");
8725 alloc_n::test();
8726 lifetime_n::test();
8727 get_n::test();
8728 //pool_n::test();
8729 }
8730 inline void test_log_out(){
8731 alloc_n::test_log_out();
8732 lifetime_n::test_log_out();
8733 get_n::test_log_out();
8734 //pool_n::test_log_out();
8735 }
8736 inline void test_end(){
8737 alloc_n::test_end();
8738 lifetime_n::test_end();
8739 get_n::test_end();
8740 //pool_n::test_end();
8741 }
8742
8743 //file_end
8744
8745 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/_body.hpp"
8746 #endif
8747
8748 //file_end
8749
8750 #line 30 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
8751 }
8752 using namespace memory;
8753
8754 namespace container{
8755 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/_body.hpp"
8756 //_body.hpp
8757 //at namespace elc::defs::container
8758 /*
8759 未完成的elc解释器base文件
8760 由steve02081504与Alex0125设计、编写
8761 转载时请在不对此文件做任何修改的同时注明出处
8762 项目地址:https://github.com/steve02081504/ELC
8763 */
8764 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/_body.hpp"
8765 //_body.hpp
8766 //at namespace elc::defs::container
8767 /*
8768 未完成的elc解释器base文件
8769 由steve02081504与Alex0125设计、编写
8770 转载时请在不对此文件做任何修改的同时注明出处
8771 项目地址:https://github.com/steve02081504/ELC
8772 */
8773 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/defs.hpp"
8774 //defs.hpp
8775 //at namespace elc::defs::container
8776 /*
8777 未完成的elc解释器base文件
8778 由steve02081504与Alex0125设计、编写
8779 转载时请在不对此文件做任何修改的同时注明出处
8780 项目地址:https://github.com/steve02081504/ELC
8781 */
8782 namespace array_n{
8783 template<typename T>
8784 class array_t{
8785 typedef array_t<T>this_t;
8786 T*_m;
8787 #if defined(DEBUG) || defined(_DEBUG)
8788 size_t _size_for_debug_view=0;
8789 #endif
8790
8791 #if defined(DEBUG) || defined(_DEBUG)
8792 /*return{ptr,size};*/
8793 constexpr array_t(T*a,size_t s):_m(a),_size_for_debug_view(s){}
8794 #else
8795 /*return{ptr};*/
8796 constexpr array_t(T*a):_m(a){}
8797 #endif
8798 /*返回一个自身的副本*/
8799 [[nodiscard]]this_t copy()const noexcept(copy_get.nothrow<T>) requires(copy_get.able<T>){
8800 #if defined(DEBUG) || defined(_DEBUG)
8801 return{copy_get(_m),_size_for_debug_view};
8802 #else
8803 return{copy_get(_m)};
8804 #endif
8805 }
8806 public:
8807 void swap_with(this_t&a)noexcept{
8808 swap(_m,a._m);
8809 #if defined(DEBUG) || defined(_DEBUG)
8810 swap(_size_for_debug_view,a._size_for_debug_view);
8811 #endif
8812 }
8813 public:
8814 /*默认构造*/
8815 constexpr array_t()noexcept:_m(null_ptr){}
8816 /*
8817 构造size个T
8818 */
8819 explicit array_t(note::size_t<size_t>size)noexcept(get<T>.nothrow<>){
8820 _m=get<T>[size.value]();
8821 #if defined(DEBUG) || defined(_DEBUG)
8822 _size_for_debug_view=size.value;
8823 #endif
8824 }
8825 explicit array_t(note::size_t<size_t>size,const T&elem)noexcept(get<T>.nothrow<>){
8826 _m=get<T>[size.value](elem);
8827 #if defined(DEBUG) || defined(_DEBUG)
8828 _size_for_debug_view=size.value;
8829 #endif
8830 }
8831 /*
8832 此重载适用于T[N],std::init_list<T>以及range_t<const T*>
8833 */
8834 //template<as_concept<get<T>.as_array.able> U>
8835 template<class U> requires(get<T>.as_array.able<U>)
8836 array_t(U&&a)noexcept(get<T>.as_array.nothrow<U>){
8837 _m=get<T>.as_array(forward<U>(a));
8838 #if defined(DEBUG) || defined(_DEBUG)
8839 _size_for_debug_view=size();
8840 #endif
8841 }
8842
8843 //复制和移动函数
8844 array_t(const this_t&a)noexcept_as(declvalue(this_t).copy()):array_t(a.copy()){}
8845 this_t&operator=(const this_t&a)&noexcept_as(declvalue(this_t).copy()){
8846 return operator=(a.copy());
8847 }
8848 array_t(this_t&&a)noexcept:array_t(){swap_with(a);}
8849 this_t&operator=(this_t&&a)&noexcept{
8850 swap_with(a);
8851 return*this;
8852 }
8853
8854 ~array_t()noexcept(unget.nothrow<T>){
8855 unget(_m);
8856 }
8857 [[nodiscard]]size_t size()const noexcept{
8858 return get_size_of_get(_m);
8859 }
8860 [[nodiscard]]size_t size_in_byte()const noexcept{
8861 return size()*sizeof(T);
8862 }
8863 static constexpr bool resize_nothrow = get_resize.nothrow<T>;
8864 void resize(size_t size)noexcept(resize_nothrow){
8865 get_resize(_m,size);
8866 #if defined(DEBUG) || defined(_DEBUG)
8867 _size_for_debug_view=size;
8868 #endif
8869 }
8870 static constexpr bool forward_resize_nothrow = get_forward_resize.nothrow<T>;
8871 void forward_resize(size_t size)noexcept(forward_resize_nothrow){
8872 get_forward_resize(_m,size);
8873 #if defined(DEBUG) || defined(_DEBUG)
8874 _size_for_debug_view=size;
8875 #endif
8876 }
8877 static constexpr bool insert_nothrow = get_resize.insert.nothrow<T>;
8878 void insert(size_t index,size_t count)noexcept(insert_nothrow){
8879 get_resize.insert(_m,index,count);
8880 #if defined(DEBUG) || defined(_DEBUG)
8881 _size_for_debug_view+=count;
8882 #endif
8883 }
8884 void insert(size_t index,size_t count,const T*data)noexcept(insert_nothrow){
8885 get_resize.insert(_m,index,count,data);
8886 #if defined(DEBUG) || defined(_DEBUG)
8887 _size_for_debug_view+=count;
8888 #endif
8889 }
8890 void insert_with_resize(size_t index,size_t count,const T*data,size_t new_size)noexcept(insert_nothrow){
8891 get_resize.insert_with_resize(_m,index,count,data,new_size);
8892 #if defined(DEBUG) || defined(_DEBUG)
8893 _size_for_debug_view=new_size;
8894 #endif
8895 }
8896 static constexpr bool insert_with_forward_resize_nothrow = get_forward_resize.insert_with_resize.nothrow<T>;
8897 void insert_with_forward_resize(size_t index,size_t count,const T*data,size_t new_size)noexcept(insert_with_forward_resize_nothrow){
8898 get_forward_resize.insert_with_resize(_m,index,count,data,new_size);
8899 #if defined(DEBUG) || defined(_DEBUG)
8900 _size_for_debug_view=new_size;
8901 #endif
8902 }
8903 [[nodiscard]]bool empty()const{
8904 return _m==null_ptr;
8905 }
8906 void clear()noexcept(re_construct.nothrow<this_t>){
8907 re_construct(this);
8908 }
8909 [[nodiscard]]T&operator[](size_t pos)noexcept{return _m[pos];}
8910 [[nodiscard]]const T&operator[](size_t pos)const noexcept{return _m[pos];}
8911 [[nodiscard]]explicit operator hash_t()const noexcept(hash.nothrow<T>){return hash(_m,size());}
8912 [[nodiscard]]explicit operator T*()noexcept{return _m;}
8913 [[nodiscard]]explicit operator const T*()const noexcept{return _m;}
8914
8915 typedef iterator_t<T>iterator;
8916 typedef const_iterator_t<T>const_iterator;
8917
8918 [[nodiscard]]constexpr iterator get_iterator_at(size_t a)noexcept{
8919 return _m+a;
8920 }
8921 [[nodiscard]]constexpr const_iterator get_iterator_at(size_t a)const noexcept{
8922 return _m+a;
8923 }
8924 [[nodiscard]]constexpr iterator begin()noexcept{
8925 return get_iterator_at(zero);
8926 }
8927 [[nodiscard]]iterator end()noexcept{
8928 return get_iterator_at(size());
8929 }
8930 [[nodiscard]]constexpr const_iterator begin()const noexcept{
8931 return get_iterator_at(zero);
8932 }
8933 [[nodiscard]]const_iterator end()const noexcept{
8934 return get_iterator_at(size());
8935 }
8936 [[nodiscard]]const_iterator cbegin()const noexcept{
8937 return begin();
8938 }
8939 [[nodiscard]]const_iterator cend()const noexcept{
8940 return end();
8941 }
8942
8943 [[nodiscard]]constexpr auto operator<=>(array_like_view_t<const T> a)const noexcept(compare.nothrow<array_like_view_t<T>>){
8944 return compare(array_like_view_t<const T>(*this),a);
8945 }
8946 [[nodiscard]]constexpr auto operator==(array_like_view_t<const T> a)const noexcept(equal.nothrow<array_like_view_t<T>>){
8947 return equal(array_like_view_t<const T>(*this),a);
8948 }
8949 [[nodiscard]]constexpr auto operator<=>(const this_t&a)const noexcept(compare.nothrow<array_like_view_t<T>>){
8950 return operator<=>(array_like_view_t<const T>(a));
8951 }
8952 [[nodiscard]]constexpr auto operator==(const this_t&a)const noexcept(equal.nothrow<array_like_view_t<T>>){
8953 return operator==(array_like_view_t<const T>(a));
8954 }
8955
8956 #define expr declvalue(func_t)(declvalue(T&))
8957 template<typename func_t> requires was_not_an_ill_form(expr)
8958 void for_each(func_t&&func)noexcept_as(expr){
8959 auto asize=size();
8960 while(asize--)
8961 func((*this)[asize]);
8962 }
8963 #undef expr
8964
8965 #define expr declvalue(func_t)(declvalue(const T&))
8966 template<typename func_t> requires was_not_an_ill_form(expr)
8967 void for_each(func_t&&func)const noexcept_as(expr){
8968 auto asize=size();
8969 while(asize--)
8970 func((*this)[asize]);
8971 }
8972 #undef expr
8973
8974 void push_back(const T&a){
8975 get<T>.apply_end(note::to<T*&>(_m),a);
8976 #if defined(DEBUG) || defined(_DEBUG)
8977 _size_for_debug_view=size();
8978 #endif
8979 }
8980 void push_back(T&&a){
8981 get<T>.apply_end(note::to<T*&>(_m),move(a));
8982 #if defined(DEBUG) || defined(_DEBUG)
8983 _size_for_debug_view=size();
8984 #endif
8985 }
8986 void remove(T a){
8987 get<T>.remove(a,note::from(_m));
8988 #if defined(DEBUG) || defined(_DEBUG)
8989 _size_for_debug_view=size();
8990 #endif
8991 }
8992 //template<as_concept<get<T>.apply_end.able> U>
8993 template<class U,enable_if(get<T>.apply_end.able)>
8994 friend this_t&operator+=(this_t&a,U&&b)noexcept(get<T>.apply_end.nothrow<U>){
8995 get<T>.apply_end(note::to(a._m),b);
8996 return a;
8997 }
8998 friend this_t&operator+=(this_t&a,zero_t b)noexcept(get<T>.apply_end.nothrow<T>){
8999 return a+=T(0);
9000 }
9001 template<typename U>
9002 friend this_t operator+(const this_t&a,U&&b)noexcept_as(a.copy()+=b) requires was_not_an_ill_form(a.copy()+=b){
9003 return a.copy()+=b;
9004 }
9005 template<typename U>
9006 friend this_t operator+(U&&a,const this_t&b)noexcept_as(this_t(a)+=b) requires was_not_an_ill_form(this_t(a)+=b){
9007 return this_t(a)+=b;
9008 }
9009
9010 template<typename U>
9011 this_t&& operator+(U&& b)&&noexcept_as(*this+=b) requires was_not_an_ill_form(*this+=b){//对右值的operator+优化为operator+=
9012 return *this+=b;
9013 }
9014
9015
9016 template<typename U>
9017 [[nodiscard]]iterator find(U&&a)noexcept requires was_not_an_ill_form(in_range(declvalue(this_t),a)){
9018 return in_range(*this,a);
9019 }
9020 template<typename U>
9021 [[nodiscard]]const_iterator find(U&&a)const noexcept requires was_not_an_ill_form(in_range(declvalue(this_t),a)){
9022 return in_range(*this,a);
9023 }
9024 };
9025 template<typename T>
9026 inline void swap(array_t<T>&a,array_t<T>&b)noexcept{a.swap_with(b);}
9027
9028 template<class T>
9029 [[nodiscard]]inline auto size_of_array_like(const array_t<remove_cv<T>>&a)noexcept{return a.size();}
9030 template<class T>
9031 [[nodiscard]]inline auto begin_of_array_like(array_t<remove_cv<T>>&a)noexcept{return(T*)a.begin();}
9032 template<class T>
9033 [[nodiscard]]inline auto begin_of_array_like(const array_t<remove_cv<T>>&a)noexcept{return(const T*)a.begin();}
9034 }
9035
9036 //file_end
9037
9038 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/_body.hpp"
9039 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/deduction_guides.hpp"
9040 //deduction_guides.hpp
9041 //at namespace elc::defs::container
9042 /*
9043 未完成的elc解释器base文件
9044 由steve02081504与Alex0125设计、编写
9045 转载时请在不对此文件做任何修改的同时注明出处
9046 项目地址:https://github.com/steve02081504/ELC
9047 */
9048 namespace array_n{
9049 template <class T,class...U>
9050 array_t(T,U...) -> array_t<T>;
9051 template <class T>
9052 array_t(array_t<T>) -> array_t<T>;
9053 }
9054
9055 //file_end
9056
9057 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/_body.hpp"
9058 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/_export.hpp"
9059 //_export.hpp
9060 //at namespace elc::defs::container
9061 /*
9062 未完成的elc解释器base文件
9063 由steve02081504与Alex0125设计、编写
9064 转载时请在不对此文件做任何修改的同时注明出处
9065 项目地址:https://github.com/steve02081504/ELC
9066 */
9067 #define export using array_n::
9068 export array_t;
9069 #undef export
9070
9071 //file_end
9072
9073 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/_body.hpp"
9074 #if defined(ELC_TEST_ON)
9075 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/_test.hpp"
9076 //_test.hpp
9077 //at namespace elc::defs::container
9078 /*
9079 未完成的elc解释器base文件
9080 由steve02081504与Alex0125设计、编写
9081 转载时请在不对此文件做任何修改的同时注明出处
9082 项目地址:https://github.com/steve02081504/ELC
9083 */
9084 namespace array_n{
9085 //BLOCK:for debug
9086 inline void test(){
9087 ELC_TEST_EVENTNAME("array部分测试");
9088 {
9089 array_t<int>anarray;
9090 stest_accert(anarray.size()==0);
9091 anarray.resize(5);
9092 stest_accert(anarray.size()==5);
9093 anarray[2]=99;
9094 stest_accert(anarray[2]==99);
9095 anarray.resize(3);
9096 stest_accert(anarray[2]==99);
9097 anarray=anarray;
9098 swap(anarray,anarray);
9099 }
9100 check_memory_lack();
9101 }
9102 inline void test_log_out(){
9103 }
9104 inline void test_end(){
9105 }
9106 //BLOCK_END
9107 }
9108
9109 //file_end
9110
9111 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/array/_body.hpp"
9112 #endif
9113
9114 //file_end
9115
9116 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/_body.hpp"
9117 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/_body.hpp"
9118 //_body.hpp
9119 //at namespace elc::defs::container
9120 /*
9121 未完成的elc解释器base文件
9122 由steve02081504与Alex0125设计、编写
9123 转载时请在不对此文件做任何修改的同时注明出处
9124 项目地址:https://github.com/steve02081504/ELC
9125 */
9126 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/base_function_t.hpp"
9127 //base_function_t.hpp
9128 //at namespace elc::defs::container
9129 /*
9130 未完成的elc解释器base文件
9131 由steve02081504与Alex0125设计、编写
9132 转载时请在不对此文件做任何修改的同时注明出处
9133 项目地址:https://github.com/steve02081504/ELC
9134 */
9135 namespace function_n{
9136 template<class T>
9138 template<class Ret_t,class...Args_t>
9139 no_vtable_struct base_func_data_t<Ret_t(Args_t...)>:type_info_t<base_func_data_t<Ret_t(Args_t...)>>::template_name with_common_attribute<abstract_base,ref_able,never_in_array>,build_by_get_only{
9140 typedef base_func_data_t<Ret_t(Args_t...)>this_t;
9141 typedef comn_ptr_t<this_t>ptr_t;
9142
9143 virtual ~base_func_data_t()=default;
9144 virtual Ret_t call(Args_t...)=0;
9145 //for equal:
9146 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept=0;
9147 [[nodiscard]]virtual const void*get_data_begin()const noexcept=0;
9148 [[nodiscard]]virtual bool equal_with(const void*)const=0;
9149 [[noreturn]] virtual void throw_self_ptr()const=0;
9150 [[noreturn]] virtual void throw_self_ptr()=0;
9151 [[nodiscard]]bool operator==(const this_t&a)const{
9152 return this->get_type_info()==a.get_type_info()&&this->equal_with(a.get_data_begin());
9153 }
9154 template<typename T>
9155 [[nodiscard]]bool operator==(const T&a)const{
9156 return this->get_type_info()==type_info<T>&&this->equal_with(addressof(a));
9157 }
9158 typedef Ret_t(*func_ptr_t)(Args_t...);
9159 virtual func_ptr_t get_func_ptr()const noexcept{return nullptr;}
9160 };
9161
9162 template<class T,class Func_t>
9164 template<class T,class Ret_t,class...Args_t>
9165 struct func_data_t<T,Ret_t(Args_t...)>final:
9166 type_info_t<func_data_t<T,Ret_t(Args_t...)>>::template_name with_common_attribute<instance_struct>,
9167 base_func_data_t<Ret_t(Args_t...)>,function_data_warpper_t<T,Ret_t(Args_t...)>{
9168 static_assert(!::std::is_function_v<T>);
9169 typedef base_func_data_t<Ret_t(Args_t...)>base_t;
9170 typedef func_data_t<T,Ret_t(Args_t...)>this_t;
9171 typedef function_data_warpper_t<T,Ret_t(Args_t...)>data_t;
9172 typedef base_t::ptr_t ptr_t;
9173 typedef base_t::func_ptr_t func_ptr_t;
9174
9175 [[nodiscard]]bool is_unique()const noexcept{return get_ref_num((base_t*)this)==1;}
9176
9177 using data_t::data_t;
9178 virtual ~func_data_t()override=default;
9179 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override final{return type_info<T>;}
9180 [[nodiscard]]virtual const void*get_data_begin()const noexcept override final{return addressof(data_t::get_data());}
9181 [[noreturn]] virtual void throw_self_ptr()const override final{throw addressof(data_t::get_data());}
9182 [[noreturn]] virtual void throw_self_ptr()override final{throw addressof(data_t::get_data());}
9183 [[nodiscard]]virtual bool equal_with(const void*a)const noexcept(equal.able<T>?equal.nothrow<T>:true)override final{
9184 if constexpr(equal.able<T>)
9185 return data_t::get_data()==*remove_const(reinterpret_cast<const T*>(a));
9186 else
9187 return false;
9188 }
9189 [[nodiscard]]virtual Ret_t call(Args_t...args)noexcept(invoke<T>.nothrow<Args_t...>)override final{
9190 return data_t::operator()(forward<Args_t>(args)...);
9191 }
9192
9193 //func ptr convert
9194 virtual func_ptr_t get_func_ptr()const noexcept override final{
9195 if constexpr(type_info<const T>.can_convert_to<func_ptr_t>)
9196 return static_cast<func_ptr_t>(data_t::get_data());
9197 else
9198 return nullptr;
9199 }
9200 };
9201
9202 template<class T>
9204 template<class Ret_t,class...Args_t>
9205 struct default_func_data_t<Ret_t(Args_t...)>final:base_func_data_t<Ret_t(Args_t...)>,instance_struct<default_func_data_t<Ret_t(Args_t...)>>{
9206 typedef base_func_data_t<Ret_t(Args_t...)>base_t;
9207 typedef base_t::ptr_t ptr_t;
9208
9209 virtual ~default_func_data_t()noexcept override final{}
9210 virtual Ret_t call(Args_t...)noexcept_as(Ret_t())override final{return Ret_t();}
9211 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override final{return type_info<void>;}
9212 [[nodiscard]]virtual const void*get_data_begin()const noexcept override final{return null_ptr;}//这玩意实际上用不到,艹
9213 [[noreturn]] virtual void throw_self_ptr()const override final{throw(const void*)null_ptr;}
9214 [[noreturn]] virtual void throw_self_ptr()override final{throw(void*)null_ptr;}
9215 [[nodiscard]]virtual bool equal_with(const void*)const noexcept override final{return true;}
9216 };
9217 template<class Ret_t,class...Args_t>
9218 distinctive inline default_func_data_t<Ret_t(Args_t...)>default_func_data{};
9219
9220 template<class Ret_t,class...Args_t>
9221 [[nodiscard]]constexpr base_func_data_t<Ret_t(Args_t...)>*the_get_null_ptr(const base_func_data_t<Ret_t(Args_t...)>*)noexcept{
9222 return&default_func_data<Ret_t,Args_t...>;
9223 }
9224
9225 template<class T>
9227 template<class Ret_t,class...Args_t>
9228 class function_data_saver_t<Ret_t(Args_t...)>{
9229 protected:
9230 typedef function_data_saver_t<Ret_t(Args_t...)>this_t;
9231 typedef base_func_data_t<Ret_t(Args_t...)> base_t_w;
9232 typedef comn_ptr_t<base_t_w>ptr_t;
9233
9234 mutable ptr_t _m;
9235 void swap_with(this_t&a)noexcept{swap(_m,a._m);}
9236 public:
9237 function_data_saver_t()noexcept=default;
9238 function_data_saver_t(const this_t&a)noexcept:_m(a._m){}
9239 function_data_saver_t(this_t&&a)noexcept{swap_with(a);}
9240 [[nodiscard]]bool operator==(const this_t&a)const{
9241 return *_m==*(a._m);
9242 }
9243 template<typename T> requires(equal.able<base_t_w,T>)
9244 [[nodiscard]]bool operator==(T&&a)const noexcept(equal.nothrow<base_t_w,T>){
9245 return *_m==a;
9246 }
9247 template<typename T>
9248 [[nodiscard]]bool was_an()const noexcept{
9249 try{
9250 _m->throw_self_ptr();
9251 }
9252 catch(const T*p){
9253 return true;
9254 }
9255 catch(const void*){}
9256 return false;
9257 }
9258 template<typename T>
9259 [[nodiscard]]maybe_fail_reference<T> get_as()noexcept{
9260 try{
9261 _m->throw_self_ptr();
9262 }
9263 catch(T*p){
9264 return *p;
9265 }
9266 catch(void*){}
9267 return note::fail;
9268 }
9269 suppress_msvc_warning(26440)//nothrow警告diss
9270 void operator=(const this_t&a){_m=a._m;}
9271 Ret_t call(Args_t&&...rest)const{return _m->call(forward<Args_t>(rest)...);}
9272 };
9273
9274 #if !defined(_MSC_VER)
9275 template<class T,bool promise_nothrow_at_destruct>
9277 template<class Ret_t,class...Args_t,bool nothrow,bool promise_nothrow_at_destruct>
9278 struct base_function_t<Ret_t(Args_t...)noexcept(nothrow),promise_nothrow_at_destruct>:function_data_saver_t<Ret_t(Args_t...)>{
9279 protected:
9280 typedef function_data_saver_t<Ret_t(Args_t...)>base_t;
9281 typedef base_function_t<Ret_t(Args_t...)noexcept(nothrow),promise_nothrow_at_destruct>this_t;
9282
9283 template<class,bool>
9284 friend class base_function_t;
9285
9286 template<class U>
9287 using func_data_t=function_n::func_data_t<U,Ret_t(Args_t...)>;
9288
9289 typedef Ret_t(*func_ptr_t)(Args_t...)noexcept(nothrow);
9290
9291 using base_t::ptr_t;
9292 using base_t::_m;
9293
9294 template<class T>
9295 static constexpr bool base_on_this_t_or_more_stringent_restrictions=(
9296 type_info<T>.base_on<this_t>||
9297 type_info<T>.base_on<base_function_t<Ret_t(Args_t...)noexcept(bool(nothrow+1)), promise_nothrow_at_destruct >>||
9298 type_info<T>.base_on<base_function_t<Ret_t(Args_t...)noexcept(nothrow), bool(promise_nothrow_at_destruct+1) >>||
9299 type_info<T>.base_on<base_function_t<Ret_t(Args_t...)noexcept(bool(nothrow+1)), bool(promise_nothrow_at_destruct+1) >>
9300 );
9301
9302 template<class T>
9303 static constexpr bool get_data_able=invoke<T>.able<Args_t...> && not base_on_this_t_or_more_stringent_restrictions<T>;
9304 template<class T>
9305 static constexpr bool get_data_nothrow=get<func_data_t<remove_cvref<T>>>.nothrow<T>;
9306
9307 template<class T> requires(get_data_able<T> && get<func_data_t<remove_cvref<T>>>.able<T>)
9308 static ptr_t get_data_from(T&&a)noexcept(get_data_nothrow<T>){
9309 //BLOCK:constexpr checks
9310 if constexpr(promise_nothrow_at_destruct and not destruct.nothrow<T>)
9311 template_error("unexpected assign.");
9312 if constexpr(nothrow)
9313 if constexpr(!invoke<T>.nothrow<Args_t...>)
9314 template_warning("the call of T was not noexcept,this may cause terminate.");
9315 //BLOCK_END
9316 return get<func_data_t<remove_cvref<T>>>(a);
9317 }
9318 explicit base_function_t(base_t::ptr_t a)noexcept{_m=a;}
9319 public:
9320 void swap_with(this_t&a)noexcept{//不与base_t::swap_with重复:与更加严格(或宽松)的this_t进行swap是错误的
9321 base_t::swap_with(a);
9322 }
9323
9324 base_function_t()noexcept=default;
9325 template<class T> requires base_on_this_t_or_more_stringent_restrictions<T>
9326 base_function_t(const T&a)noexcept:base_t(a){}
9327 base_function_t(const this_t&a)noexcept:base_t(a){}
9329 swap_with(a);
9330 }
9331 base_function_t(null_ptr_t)noexcept:base_function_t(){}
9332 base_function_t(nullptr_t)noexcept:base_function_t(null_ptr){}
9333 template<class T> requires(get_data_able<T>)
9334 base_function_t(T&&a)noexcept(get_data_nothrow<T>){
9335 _m=get_data_from(forward<T>(a));
9336 }
9337 base_function_t(func_ptr_t a)noexcept{//当nothrow==0时,noexcept(true)的参数可自动转为noexcept(false)的,不用再次考虑
9338 _m=get<func_data_t<func_ptr_t>>(a);
9339 }
9340 ~base_function_t()noexcept(promise_nothrow_at_destruct)=default;
9341
9342 this_t&operator=(const this_t&a)&noexcept(promise_nothrow_at_destruct)=default;
9343 this_t&operator=(this_t&&a)&noexcept(promise_nothrow_at_destruct)=default;
9344 this_t&operator=(null_ptr_t)&noexcept(promise_nothrow_at_destruct){_m=null_ptr;return *this;}
9345 this_t&operator=(nullptr_t)&noexcept(promise_nothrow_at_destruct){return *this=null_ptr;}
9346 template<class T> requires base_on_this_t_or_more_stringent_restrictions<T>
9347 this_t&operator=(const T&a)&noexcept(promise_nothrow_at_destruct){
9348 base_t::operator=(a);
9349 return*this;
9350 }
9351 template<class T> requires(get_data_able<T>)
9352 this_t&operator=(T&&a)noexcept(get_data_nothrow<T> && promise_nothrow_at_destruct){
9353 _m=get_data_from(forward<T>(a));
9354 return*this;
9355 }
9356
9357 this_t deep_copy(){return this_t{copy_get(_m.get())};}
9358
9359 [[nodiscard]]explicit operator bool()const noexcept{
9360 return bool(_m);
9361 }
9362
9363 Ret_t operator()(Args_t...args)const noexcept(nothrow){
9364 suppress_msvc_warning(26447)
9365 return base_t::call(forward<Args_t>(args)...);
9366 }
9367
9368 private:
9369 //以下是突然想加的功能(没什么用<迷惑行为大赏>).
9370 static thread_local inline base_t::base_t_w* _func_ptr_data_local=nullptr;
9371 static inline ::std::atomic<decltype(_func_ptr_data_local)> _func_ptr_data_gobal=nullptr;
9372 static Ret_t _func_ptr_value(Args_t...args)noexcept{
9373 if(!_func_ptr_data_local)
9374 _func_ptr_data_local=_func_ptr_data_gobal.load(::std::memory_order_relaxed);
9375 return _func_ptr_data_local->call(forward<Args_t>(args)...);
9376 }
9377 public:
9378 //自当前function对象生成一个函数指针,具有与当前function对象相同的行为
9379 //注意:该函数指针的有效性保留到当前线程下一个同类型的函数指针生成时或当前function对象析构时
9380 //若自该函数指针创建一个新的线程,该函数指针在新线程中的行为与调用时以前所有线程中最后一个生成的同类型的函数指针行为相同
9381 [[nodiscard]]explicit operator func_ptr_t()const noexcept(promise_nothrow_at_destruct){
9382 func_ptr_t a=(func_ptr_t)_m->get_func_ptr();
9383 if(a)return a;
9384 _func_ptr_data_local=base_t::_m.get();
9385 _func_ptr_data_gobal.store(_func_ptr_data_local,::std::memory_order_relaxed);
9386 return _func_ptr_value;
9387 }
9388 };
9389 #else
9390 //MSVC,我滴垃圾堆
9391 template<class T,bool promise_nothrow_at_destruct>
9392 class base_function_t;
9393 template<class Ret_t,class...Args_t,bool promise_nothrow_at_destruct>
9394 struct base_function_t<Ret_t(Args_t...),promise_nothrow_at_destruct>:function_data_saver_t<Ret_t(Args_t...)>{
9395 protected:
9396 typedef function_data_saver_t<Ret_t(Args_t...)>base_t;
9397 typedef base_function_t<Ret_t(Args_t...),promise_nothrow_at_destruct>this_t;
9398
9399 template<class,bool>
9400 friend class base_function_t;
9401
9402 template<class U>
9403 using func_data_t=function_n::func_data_t<U,Ret_t(Args_t...)>;
9404
9405 typedef Ret_t(*func_ptr_t)(Args_t...);
9406
9407 using base_t::ptr_t;
9408 using base_t::_m;
9409
9410 template<class T>
9411 static constexpr bool base_on_this_t_or_more_stringent_restrictions=(
9412 type_info<T>.base_on<this_t>||
9413 type_info<T>.base_on<base_function_t<Ret_t(Args_t...)noexcept, promise_nothrow_at_destruct >>||
9414 type_info<T>.base_on<base_function_t<Ret_t(Args_t...), bool(promise_nothrow_at_destruct+1) >>||
9415 type_info<T>.base_on<base_function_t<Ret_t(Args_t...)noexcept, bool(promise_nothrow_at_destruct+1) >>
9416 );
9417
9418 template<class T>
9419 static constexpr bool get_data_able=invoke<T>.able<Args_t...> && not base_on_this_t_or_more_stringent_restrictions<T>;
9420 template<class T>
9421 static constexpr bool get_data_nothrow=get<func_data_t<remove_cvref<T>>>.nothrow<T>;
9422
9423 template<class T> requires(get_data_able<T> && get<func_data_t<remove_cvref<T>>>.able<T>)
9424 static auto get_data_from(T&&a)noexcept(get_data_nothrow<T>){
9425 //BLOCK:constexpr checks
9426 if constexpr(promise_nothrow_at_destruct and not destruct.nothrow<T>)
9427 template_error("unexpected assign.");
9428 //BLOCK_END
9429 return get<func_data_t<remove_cvref<T>>>(a);
9430 }
9431 explicit base_function_t(base_t::ptr_t a)noexcept{_m=a;}
9432 public:
9433 void swap_with(this_t&a)noexcept{//不与base_t::swap_with重复:与更加严格(或宽松)的this_t进行swap是错误的
9434 base_t::swap_with(a);
9435 }
9436
9437 base_function_t()noexcept=default;
9438 template<class T> requires base_on_this_t_or_more_stringent_restrictions<T>
9439 base_function_t(const T&a)noexcept:base_t(a){}
9440 base_function_t(const this_t&a)noexcept:base_t(a){}
9441 base_function_t(this_t&&a)noexcept:base_function_t(){
9442 swap_with(a);
9443 }
9444 base_function_t(null_ptr_t)noexcept:base_function_t(){}
9445 base_function_t(nullptr_t)noexcept:base_function_t(null_ptr){}
9446 template<class T> requires(get_data_able<T>)
9447 base_function_t(T&&a)noexcept(get_data_nothrow<T>){
9448 _m=get_data_from(forward<T>(a));
9449 }
9450 base_function_t(func_ptr_t a)noexcept{//当nothrow==0时,noexcept(true)的参数可自动转为noexcept(false)的,不用再次考虑
9451 _m=get<func_data_t<func_ptr_t>>(a);
9452 }
9453 ~base_function_t()noexcept(promise_nothrow_at_destruct)=default;
9454
9455 this_t&operator=(const this_t&a)noexcept(promise_nothrow_at_destruct)=default;
9456 this_t&operator=(this_t&&a)noexcept(promise_nothrow_at_destruct)=default;
9457 this_t&operator=(null_ptr_t)noexcept(promise_nothrow_at_destruct){_m=null_ptr;return *this;}
9458 this_t&operator=(nullptr_t)noexcept(promise_nothrow_at_destruct){return *this=null_ptr;}
9459 template<class T> requires base_on_this_t_or_more_stringent_restrictions<T>
9460 this_t&operator=(const T&a)&noexcept(promise_nothrow_at_destruct){
9461 base_t::operator=(a);
9462 return*this;
9463 }
9464 template<class T> requires(get_data_able<T>)
9465 this_t&operator=(T&&a)noexcept(get_data_nothrow<T> && promise_nothrow_at_destruct){
9466 _m=get_data_from(forward<T>(a));
9467 return*this;
9468 }
9469
9470 this_t deep_copy(){return this_t{copy_get(_m.get())};}
9471
9472 [[nodiscard]]explicit operator bool()const noexcept{
9473 return bool(_m);
9474 }
9475
9476 Ret_t operator()(Args_t...args){
9477 return base_t::call(forward<Args_t>(args)...);
9478 }
9479 Ret_t operator()(Args_t...args)const{
9480 return base_t::call(forward<Args_t>(args)...);
9481 }
9482
9483 private:
9484 //以下是突然想加的功能(没什么用<迷惑行为大赏>).
9485 static thread_local inline base_t::base_t_w* _func_ptr_data_local=nullptr;
9486 static inline ::std::atomic<decltype(_func_ptr_data_local)> _func_ptr_data_gobal=nullptr;
9487 static Ret_t _func_ptr_value(Args_t...args)noexcept{
9488 if(!_func_ptr_data_local)
9489 _func_ptr_data_local=_func_ptr_data_gobal.load(::std::memory_order_relaxed);
9490 return _func_ptr_data_local->call(forward<Args_t>(args)...);
9491 }
9492 public:
9493 //自当前function对象生成一个函数指针,具有与当前function对象相同的行为
9494 //注意:该函数指针的有效性保留到当前线程下一个同类型的函数指针生成时或当前function对象析构时
9495 //若自该函数指针创建一个新的线程,该函数指针在新线程中的行为与调用时以前所有线程中最后一个生成的同类型的函数指针行为相同
9496 [[nodiscard]]explicit operator func_ptr_t()const noexcept(promise_nothrow_at_destruct){
9497 func_ptr_t a=(func_ptr_t)_m->get_func_ptr();
9498 if(a)return a;
9499 _func_ptr_data_local=base_t::_m.get();
9500 _func_ptr_data_gobal.store(_func_ptr_data_local,::std::memory_order_relaxed);
9501 return _func_ptr_value;
9502 }
9503 };
9504 template<class Ret_t,class...Args_t,bool promise_nothrow_at_destruct>
9505 struct base_function_t<Ret_t(Args_t...)noexcept,promise_nothrow_at_destruct>:function_data_saver_t<Ret_t(Args_t...)>{
9506 protected:
9507 typedef function_data_saver_t<Ret_t(Args_t...)>base_t;
9508 typedef base_function_t<Ret_t(Args_t...)noexcept,promise_nothrow_at_destruct>this_t;
9509
9510 template<class,bool>
9511 friend class base_function_t;
9512
9513 template<class U>
9514 using func_data_t=function_n::func_data_t<U,Ret_t(Args_t...)>;
9515
9516 typedef Ret_t(*func_ptr_t)(Args_t...)noexcept;
9517
9518 using base_t::ptr_t;
9519 using base_t::_m;
9520
9521 template<class T>
9522 static constexpr bool base_on_this_t_or_more_stringent_restrictions=(
9523 type_info<T>.base_on<this_t>||
9524 type_info<T>.base_on<base_function_t<Ret_t(Args_t...)noexcept, promise_nothrow_at_destruct >>||
9525 type_info<T>.base_on<base_function_t<Ret_t(Args_t...)noexcept, bool(promise_nothrow_at_destruct+1) >>
9526 );
9527
9528 template<class T>
9529 static constexpr bool get_data_able=invoke<T>.able<Args_t...> && not base_on_this_t_or_more_stringent_restrictions<T>;
9530 template<class T>
9531 static constexpr bool get_data_nothrow=get<func_data_t<remove_cvref<T>>>.nothrow<T>;
9532
9533 template<class T> requires(get_data_able<T> && get<func_data_t<remove_cvref<T>>>.able<T>)
9534 static auto get_data_from(T&&a)noexcept(get_data_nothrow<T>){
9535 //BLOCK:constexpr checks
9536 if constexpr(promise_nothrow_at_destruct and not destruct.nothrow<T>)
9537 template_error("unexpected assign.");
9538 if constexpr(1)
9539 if constexpr(!invoke<T>.nothrow<Args_t...>)
9540 template_warning("the call of T was not noexcept,this may cause terminate.");
9541 //BLOCK_END
9542 return get<func_data_t<remove_cvref<T>>>(a);
9543 }
9544 explicit base_function_t(base_t::ptr_t a)noexcept{_m=a;}
9545 public:
9546 void swap_with(this_t&a)noexcept{//不与base_t::swap_with重复:与更加严格(或宽松)的this_t进行swap是错误的
9547 base_t::swap_with(a);
9548 }
9549
9550 base_function_t()noexcept=default;
9551 template<class T> requires base_on_this_t_or_more_stringent_restrictions<T>
9552 base_function_t(const T&a)noexcept:base_t(a){}
9553 base_function_t(const this_t&a)noexcept:base_t(a){}
9554 base_function_t(this_t&&a)noexcept:base_function_t(){
9555 swap_with(a);
9556 }
9557 base_function_t(null_ptr_t)noexcept:base_function_t(){}
9558 base_function_t(nullptr_t)noexcept:base_function_t(null_ptr){}
9559 template<class T> requires(get_data_able<T>)
9560 base_function_t(T&&a)noexcept(get_data_nothrow<T>){
9561 _m=get_data_from(forward<T>(a));
9562 }
9563 base_function_t(func_ptr_t a)noexcept{//当nothrow==0时,noexcept(true)的参数可自动转为noexcept(false)的,不用再次考虑
9564 _m=get<func_data_t<func_ptr_t>>(a);
9565 }
9566 ~base_function_t()noexcept(promise_nothrow_at_destruct)=default;
9567
9568 this_t&operator=(const this_t&a)&noexcept(promise_nothrow_at_destruct)=default;
9569 this_t&operator=(this_t&&a)&noexcept(promise_nothrow_at_destruct)=default;
9570 this_t&operator=(null_ptr_t)&noexcept(promise_nothrow_at_destruct){_m=null_ptr;return *this;}
9571 this_t&operator=(nullptr_t)&noexcept(promise_nothrow_at_destruct){return *this=null_ptr;}
9572 template<class T> requires base_on_this_t_or_more_stringent_restrictions<T>
9573 this_t&operator=(const T&a)&noexcept(promise_nothrow_at_destruct){
9574 base_t::operator=(a);
9575 return*this;
9576 }
9577 template<class T> requires(get_data_able<T>)
9578 this_t&operator=(T&&a)noexcept(get_data_nothrow<T> && promise_nothrow_at_destruct){
9579 _m=get_data_from(forward<T>(a));
9580 return*this;
9581 }
9582
9583 this_t deep_copy(){return this_t{copy_get(_m.get())};}
9584
9585 [[nodiscard]]explicit operator bool()const noexcept{
9586 return bool(_m);
9587 }
9588
9589 Ret_t operator()(Args_t...args)noexcept{
9590 suppress_msvc_warning(26447)
9591 return base_t::call(forward<Args_t>(args)...);
9592 }
9593 Ret_t operator()(Args_t...args)const noexcept{
9594 suppress_msvc_warning(26447)
9595 return base_t::call(forward<Args_t>(args)...);
9596 }
9597
9598 private:
9599 //以下是突然想加的功能(没什么用<迷惑行为大赏>).
9600 static thread_local inline base_t::base_t_w* _func_ptr_data_local=nullptr;
9601 static inline ::std::atomic<decltype(_func_ptr_data_local)> _func_ptr_data_gobal=nullptr;
9602 static Ret_t _func_ptr_value(Args_t...args)noexcept{
9603 if(!_func_ptr_data_local)
9604 _func_ptr_data_local=_func_ptr_data_gobal.load(::std::memory_order_relaxed);
9605 return _func_ptr_data_local->call(forward<Args_t>(args)...);
9606 }
9607 public:
9608 //自当前function对象生成一个函数指针,具有与当前function对象相同的行为
9609 //注意:该函数指针的有效性保留到当前线程下一个同类型的函数指针生成时或当前function对象析构时
9610 //若自该函数指针创建一个新的线程,该函数指针在新线程中的行为与调用时以前所有线程中最后一个生成的同类型的函数指针行为相同
9611 [[nodiscard]]explicit operator func_ptr_t()const noexcept(promise_nothrow_at_destruct){
9612 func_ptr_t a=(func_ptr_t)_m->get_func_ptr();
9613 if(a)return a;
9614 _func_ptr_data_local=base_t::_m.get();
9615 _func_ptr_data_gobal.store(_func_ptr_data_local,::std::memory_order_relaxed);
9616 return _func_ptr_value;
9617 }
9618 };
9619 #endif
9620 template<class T,bool promise_nothrow_at_destruct>
9621 void swap(base_function_t<T,promise_nothrow_at_destruct>&a,base_function_t<T,promise_nothrow_at_destruct>&b)noexcept{
9622 a.swap_with(b);
9623 }
9624 }
9625
9626 //file_end
9627
9628 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/_body.hpp"
9629 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/defs.hpp"
9630 //defs.hpp
9631 //at namespace elc::defs::container
9632 /*
9633 未完成的elc解释器base文件
9634 由steve02081504与Alex0125设计、编写
9635 转载时请在不对此文件做任何修改的同时注明出处
9636 项目地址:https://github.com/steve02081504/ELC
9637 */
9638 namespace function_n{
9639 template<class T>
9640 using function_t=base_function_t<T,true>;
9641
9642 //[[deprecated("not safe")]]//用这么长名字的人大概知道自己在干啥
9643 template<class T>
9644 using may_throw_in_destruct_function_t=base_function_t<T,false>;
9645 }
9646
9647 //file_end
9648
9649 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/_body.hpp"
9650 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/deduction_guides.hpp"
9651 //deduction_guides.hpp
9652 //at namespace elc::defs::container
9653 /*
9654 未完成的elc解释器base文件
9655 由steve02081504与Alex0125设计、编写
9656 转载时请在不对此文件做任何修改的同时注明出处
9657 项目地址:https://github.com/steve02081504/ELC
9658 */
9659 namespace function_n{
9660 template<typename T,typename Func_t=get_function_type<T>,bool promise_nothrow_at_destruct>
9661 base_function_t(T)->base_function_t<Func_t,promise_nothrow_at_destruct>;
9662 }
9663
9664 //file_end
9665
9666 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/_body.hpp"
9667 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/_export.hpp"
9668 //_export.hpp
9669 //at namespace elc::defs::container
9670 /*
9671 未完成的elc解释器base文件
9672 由steve02081504与Alex0125设计、编写
9673 转载时请在不对此文件做任何修改的同时注明出处
9674 项目地址:https://github.com/steve02081504/ELC
9675 */
9676 #define export using function_n::
9677 export function_t;
9678 //export may_throw_in_destruct_function_t;
9679 #undef export
9680
9681 //file_end
9682
9683 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/_body.hpp"
9684 #if defined(ELC_TEST_ON)
9685 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/_test.hpp"
9686 //_test.hpp
9687 //at namespace elc::defs::container
9688 /*
9689 未完成的elc解释器base文件
9690 由steve02081504与Alex0125设计、编写
9691 转载时请在不对此文件做任何修改的同时注明出处
9692 项目地址:https://github.com/steve02081504/ELC
9693 */
9694 namespace function_n{
9695 //BLOCK:for debug
9696 inline void test(){
9697 ELC_TEST_EVENTNAME("function部分测试");
9698 {
9699 int tester=0;
9700 #if !defined(_MSC_VER)
9701 function_t
9702 #else
9703 function_t<void()noexcept>
9704 #endif
9705 a(lambda_with_catch (&tester)()noexcept{ tester=1; });
9706 static_assert(type_info<decltype(a)> == type_info<function_t<void()noexcept>>);
9707 stest_accert(tester==0);
9708 a();
9709 stest_accert(tester==1);
9710 #if !defined(_MSC_VER)
9711 function_t
9712 #else
9713 function_t<void()>
9714 #endif
9715 b=test;
9716 static_assert(type_info<decltype(b)> == type_info<function_t<void()>>);
9717 b=a;
9718 a=null_ptr;
9719 tester=0;
9720 a();
9721 stest_accert(tester==0);
9722 b();
9723 stest_accert(tester==1);
9724 swap(a,a);
9725 stest_accert(a!=b);
9726 b=a;
9727 stest_accert(a==b);
9728 }
9729 check_memory_lack();
9730 }
9731 inline void test_log_out(){
9732 }
9733 inline void test_end(){
9734 }
9735 //BLOCK_END
9736 }
9737
9738 //file_end
9739
9740 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/function/_body.hpp"
9741 #endif
9742
9743 //file_end
9744
9745 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/_body.hpp"
9746
9747 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/_body.hpp"
9748 //_body.hpp
9749 //at namespace elc::defs::container
9750 /*
9751 未完成的elc解释器base文件
9752 由steve02081504与Alex0125设计、编写
9753 转载时请在不对此文件做任何修改的同时注明出处
9754 项目地址:https://github.com/steve02081504/ELC
9755 */
9756 namespace stack_n{
9757 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/base_stack.hpp"
9758 //defs.hpp
9759 //at namespace elc::defs::container::stack_n
9760 /*
9761 未完成的elc解释器base文件
9762 由steve02081504与Alex0125设计、编写
9763 转载时请在不对此文件做任何修改的同时注明出处
9764 项目地址:https://github.com/steve02081504/ELC
9765 */
9766 template<typename T>
9767 class base_stack_t:non_copyable{//基础容器,可用于hashtable
9768 typedef base_stack_t<T>this_t;
9769 protected:
9770 struct data_t{
9771 T _data;
9772 data_t*_next;
9773
9774 constexpr_as(construct<T>(declvalue(const T&)))data_t(const T&a,data_t*b)noexcept(construct<T>.nothrow<const T&>):_data(a),_next(b){}
9775 constexpr_as(construct<T>(declvalue(const T&)))data_t(const data_t&a)noexcept(construct<T>.nothrow<const T&>):_data(a._data),_next(null_ptr){}
9776 }*_m;
9777 size_t _size;
9778 private:
9779 this_t copy()const noexcept(copy_get.nothrow<data_t>){
9780 this_t tmp;
9781 const data_t*p=_m;
9782 data_t**p_=&tmp._m;
9783 while(p!=null_ptr){
9784 *p_=copy_get(p);
9785 p_=&(**p_)._next;
9786 p=p->_next;
9787 }
9788 tmp._size=size();
9789 return tmp;
9790 }
9791 public:
9792 constexpr base_stack_t()noexcept:_m(null_ptr),_size(0){}
9793 void swap_with(this_t&a)noexcept{
9794 swap(_m,a._m);
9795 swap(_size,a._size);
9796 }
9797 this_t&operator=(this_t&&a)&noexcept{
9798 swap_with(a);
9799 return*this;
9800 }
9801 base_stack_t(this_t&&a)noexcept:base_stack_t(){
9802 operator=(move(a));
9803 }
9804 this_t&operator=(const this_t&a)&noexcept_as(declvalue(this_t).copy()){
9805 return operator=(a.copy());
9806 }
9807 base_stack_t(const this_t&a)noexcept_as(declvalue(this_t).copy()):base_stack_t(a.copy()){}
9808 ~base_stack_t()noexcept(unget.nothrow<data_t>){
9809 suppress_msvc_warning(26494)//未初始化警告diss
9810 data_t*tmp;
9811 while(_m!=null_ptr){
9812 tmp=_m;
9813 _m=_m->_next;
9814 unget(tmp);
9815 }
9816 }
9817 void clear()noexcept(re_construct.nothrow<this_t>){
9818 re_construct(this);
9819 }
9820 [[nodiscard]]bool empty()const noexcept{
9821 return _m==null_ptr;
9822 }
9823 template<typename U>
9824 [[nodiscard]]maybe_fail_reference<T>find(U&&a)noexcept_as(declvalue(T&)==a){
9825 data_t*tmp=_m;
9826 while(tmp!=null_ptr){
9827 if(tmp->_data==a)
9828 return tmp->_data;
9829 tmp=tmp->_next;
9830 }
9831 return note::fail;
9832 }
9833 [[nodiscard]]bool in_stack(const T&a)const noexcept_as(declvalue(this_t).find(a).not_fail()){
9834 return remove_const(this)->find(a).not_fail();
9835 }
9836 [[nodiscard]]bool not_in_stack(const T&a)const noexcept_as(declvalue(this_t).in_stack(a)){
9837 return not in_stack(a);
9838 }
9839 [[nodiscard]]size_t size()const noexcept{
9840 return _size;
9841 }
9842
9843 static constexpr bool add_nothrow=noexcept(get<data_t>(declvalue(const T&),declvalue(data_t*)));
9844 void add(const T&a)noexcept(add_nothrow){
9845 _m=get<data_t>(a,_m);
9846 _size++;
9847 }
9848
9849 static constexpr bool remove_nothrow=unget.nothrow<data_t>;
9850 template<typename T_>
9851 bool remove(const T_&a)noexcept(remove_nothrow && equal.nothrow<T_,T>){//返回值:是否成功移除(容器里是否有此T)
9852 data_t*tmp=_m,**tmp_=&_m;
9853 while(tmp!=null_ptr){
9854 if(a==tmp->_data){
9855 _size--;
9856 *tmp_=tmp->_next;
9857 unget(tmp);
9858 return true;
9859 }
9860 tmp_=&tmp->_next;
9861 tmp=*tmp_;
9862 }
9863 return false;
9864 }
9865 #define expr declvalue(func_t)(declvalue(T&))
9866 template<typename func_t> requires was_not_an_ill_form(expr)
9867 void for_each(func_t&&func)noexcept_as(expr){
9868 data_t*tmp=_m;
9869 while(tmp!=null_ptr){
9870 func(tmp->_data);
9871 tmp=tmp->_next;
9872 }
9873 }
9874 #undef expr
9875
9876 #define expr declvalue(func_t)(declvalue(const T&))
9877 template<typename func_t> requires was_not_an_ill_form(expr)
9878 void for_each(func_t&&func)const noexcept_as(expr){
9879 const data_t*tmp=_m;
9880 while(tmp!=null_ptr){
9881 func(tmp->_data);
9882 tmp=tmp->_next;
9883 }
9884 }
9885 #undef expr
9886 protected:
9887 void add(data_t*a)noexcept{
9888 a->_next=_m;
9889 _m=a;
9890 _size++;
9891 }
9892 public:
9893 [[nodiscard]]hash_t get_top_hash()noexcept_as(hash(declvalue(T&))){
9894 if(_m)
9895 return hash(_m->_data);
9896 else
9897 return hash(_m);
9898 }
9899 void move_top_to(this_t&a)noexcept{
9900 _size--;
9901 auto tmp=_m;
9902 _m=_m->_next;
9903 a.add(tmp);
9904 }
9905 };
9906
9907 //file_end
9908
9909 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/_body.hpp"
9910 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/auto_stack.hpp"
9911 //defs.hpp
9912 //at namespace elc::defs::container::stack_n
9913 /*
9914 未完成的elc解释器base文件
9915 由steve02081504与Alex0125设计、编写
9916 转载时请在不对此文件做任何修改的同时注明出处
9917 项目地址:https://github.com/steve02081504/ELC
9918 */
9919 template<typename T>
9920 struct auto_stack_t:base_stack_t<T>{//提头优化容器,可用于hashtable
9921 private:
9922 typedef base_stack_t<T>base_t;
9923 typedef auto_stack_t<T>this_t;
9924
9925 using base_t::data_t;
9926 using base_t::_m;
9927 public:
9928 using base_t::base_t;
9929 auto_stack_t(const base_t&a)noexcept_as(base_t(a)):base_t(a){}
9930 auto_stack_t(base_t&&a)noexcept_as(base_t(a)):base_t(a){}
9931
9932 this_t&operator=(this_t&&a)&noexcept{base_t::operator=(move(a));return*this;}
9933 template<typename U>
9934 [[nodiscard]]maybe_fail_reference<T>find(U&&a)noexcept_as(declvalue(T&)==a){
9935 data_t*tmp=_m,**tmp_=&_m;
9936 while(tmp!=null_ptr){
9937 if(tmp->_data==a){
9938 *tmp_=tmp->_next;
9939 tmp->_next=_m;//提头
9940 _m=tmp;
9941 return tmp->_data;
9942 }
9943 tmp_=&tmp->_next;
9944 tmp=*tmp_;
9945 }
9946 return note::fail;
9947 }
9948 [[nodiscard]]bool in_stack(const T&a)const noexcept_as(declvalue(this_t).find(a).not_fail()){
9949 return remove_const(this)->find(a).not_fail();
9950 }
9951 [[nodiscard]]bool not_in_stack(const T&a)const noexcept_as(declvalue(this_t).in_stack(a)){
9952 return not in_stack(a);
9953 }
9954 };
9955
9956 //file_end
9957
9958 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/_body.hpp"
9959
9960 #if defined(ELC_TEST_ON)
9961 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/_test.hpp"
9962 //_test.hpp
9963 //at namespace elc::defs::container::stack_n
9964 /*
9965 未完成的elc解释器base文件
9966 由steve02081504与Alex0125设计、编写
9967 转载时请在不对此文件做任何修改的同时注明出处
9968 项目地址:https://github.com/steve02081504/ELC
9969 */
9970 inline void test(){
9971 ELC_TEST_EVENTNAME("stack部分测试");
9972 {
9974 stest_accert(a.size()==0);
9975 a.add(1);
9976 a.add(2);
9977 a.add(3);
9978 stest_accert(a.size()==3);
9979 a.remove(2);
9980 stest_accert(a.size()==2);
9981 int add_num=0;
9982 a.for_each(lambda_with_catch(&add_num)(int a){add_num+=a;});
9983 stest_accert(add_num==4);
9984 auto_stack_t<int>b=a;
9985 stest_accert(b.not_in_stack(2));
9986 b.remove(3);
9987 stest_accert(a.in_stack(3));
9988 a.clear();
9989 b=a;
9990 a=b;
9991 stest_accert(b.size()==0);
9992 }
9993 check_memory_lack();
9994 }
9995 inline void test_log_out(){
9996 }
9997 inline void test_end(){
9998 }
9999
10000 //file_end
10001
10002 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/_body.hpp"
10003 #endif
10004 }
10005 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/_export.hpp"
10006 //_export.hpp
10007 //at namespace elc::defs::container
10008 /*
10009 未完成的elc解释器base文件
10010 由steve02081504与Alex0125设计、编写
10011 转载时请在不对此文件做任何修改的同时注明出处
10012 项目地址:https://github.com/steve02081504/ELC
10013 */
10014 #define export using stack_n::
10015 export auto_stack_t;
10016 export base_stack_t;
10017 #undef export
10018
10019 //file_end
10020
10021 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/stacks/_body.hpp"
10022
10023 //file_end
10024
10025 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/_body.hpp"
10026 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/hash_table/_body.hpp"
10027 //_body.hpp
10028 //at namespace elc::defs::container
10029 /*
10030 未完成的elc解释器base文件
10031 由steve02081504与Alex0125设计、编写
10032 转载时请在不对此文件做任何修改的同时注明出处
10033 项目地址:https://github.com/steve02081504/ELC
10034 */
10035 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/hash_table/defs.hpp"
10036 //defs.hpp
10037 //at namespace elc::defs::container
10038 /*
10039 未完成的elc解释器base文件
10040 由steve02081504与Alex0125设计、编写
10041 转载时请在不对此文件做任何修改的同时注明出处
10042 项目地址:https://github.com/steve02081504/ELC
10043 */
10044 namespace hash_table_n{
10045 template<typename T,template<typename>class stack_t=auto_stack_t,size_t bucket_max_size=256>
10048 typedef stack_t<T>bucket_t;
10049 public:
10050 typedef array_t<bucket_t>base_t_w;
10051 private:
10052 base_t_w _m;
10053 public:
10054 void swap(base_t_w&a)noexcept{_m.swap_with(a);}
10055 private:
10056 [[nodiscard]]bucket_t&find_bucket(hash_t a)noexcept{
10057 return _m[a%_m.size()];
10058 }
10059 void bucket_count_grow()noexcept{
10060 this_t tmp(special_init,get_next_gold_size_to_resize_for_hash(_m.size()));
10061 for(bucket_t&a:_m){
10062 while(!a.empty())
10063 a.move_top_to(tmp.find_bucket(a.get_top_hash()));
10064 }
10065 swap(tmp);
10066 }
10067 hash_table_t(const base_t_w&a)noexcept:_m(a){}
10068 this_t copy()noexcept(copy_construct.nothrow<base_t_w>){
10069 return{_m};
10070 }
10071 public:
10072 hash_table_t()noexcept:_m(5){}
10073 hash_table_t(special_init_t,size_t bucket_size)noexcept:_m(bucket_size){}
10074 ~hash_table_t()noexcept(destruct.nothrow<base_t_w>)=default;
10075
10076 operator base_t_w&()noexcept{return _m;}
10077 operator const base_t_w&()const noexcept{return _m;}
10078
10079 hash_table_t(const this_t&a)noexcept:_m(a._m){}
10080 hash_table_t(this_t&&a)noexcept:_m(a._m){}
10081
10082 this_t&operator=(base_t_w&&a)&noexcept{
10083 swap(_m,a);
10084 return*this;
10085 }
10086 this_t&operator=(const base_t_w&a)&noexcept{
10087 _m=a;
10088 return*this;
10089 }
10090
10091 template<typename U>
10092 static constexpr bool hash_nothrow=noexcept(hash(declvalue(U)));
10093 template<typename U>
10094 static constexpr bool find_nothrow=hash_nothrow<U>&&noexcept(declvalue(bucket_t).find(declvalue(U)));
10095
10096 void add(const T&a)noexcept(hash_nothrow<const T&>&&bucket_t::add_nothrow){
10097 auto&bucket=find_bucket(hash(a));
10098 bucket.add(a);
10099 if(bucket.size() > bucket_max_size)
10100 bucket_count_grow();
10101 }
10102 bool remove(const T&a)noexcept(bucket_t::remove_nothrow){
10103 auto&bucket=find_bucket(hash(a));
10104 bool remove_success=bucket.remove(a);
10105 if constexpr(is_unstable_hash<T>)
10106 if(not remove_success){
10107 for(auto&i:_m){
10108 if(is_eq(i,bucket))
10109 continue;
10110 remove_success=i.remove(a);
10111 if(remove_success)
10112 break;
10113 }
10114 }
10115 return remove_success;
10116 }
10117 template<typename U>
10118 [[nodiscard]]maybe_fail_reference<T>find(U&&a)noexcept(find_nothrow<U>){
10119 auto&bucket=find_bucket(hash(a));
10120 suppress_msvc_warning(26496)//?
10121 auto reference=bucket.find(a);
10122 if constexpr(is_unstable_hash<T>)
10123 if(reference.fail()){
10124 for(auto&i:_m){
10125 if(is_eq(i,bucket))
10126 continue;
10127 re_construct[&reference](i.find(a));
10128 if(reference.not_fail())
10129 break;
10130 }
10131 }
10132 return reference;
10133 }
10134 [[nodiscard]]bool in_table(const T&a)noexcept_as(declvalue(this_t).find(a).not_fail()){
10135 return find(a).not_fail();
10136 }
10137 [[nodiscard]]bool not_in_table(const T&a)noexcept_as(declvalue(this_t).in_table(a)){
10138 return not in_table(a);
10139 }
10140
10141 size_t size()noexcept{
10142 size_t aret=0;
10143 for(const bucket_t&a:_m){
10144 aret+=a.size();
10145 }
10146 return aret;
10147 }
10148
10149 void clear()noexcept(re_construct.nothrow<this_t>){
10150 re_construct(this);
10151 }
10152
10153 #define expr declvalue(func_t)(declvalue(T&))
10154 template<typename func_t> requires was_not_an_ill_form(expr)
10155 void for_each(func_t&&func)noexcept_as(expr){
10156 for(bucket_t&a:_m){
10157 a.for_each(func);
10158 }
10159 }
10160 #undef expr
10161
10162 #define expr declvalue(func_t)(declvalue(const T&))
10163 template<typename func_t> requires was_not_an_ill_form(expr)
10164 void for_each(func_t&&func)const noexcept_as(expr){
10165 for(bucket_t&a:_m){
10166 a.for_each(func);
10167 }
10168 }
10169 #undef expr
10170
10171 #define expr declvalue(func_t)(declvalue(bucket_t&))
10172 template<typename func_t> requires was_not_an_ill_form(expr)
10173 void for_each_bucket(func_t&&func)noexcept_as(expr){
10174 _m.for_each(func);
10175 }
10176 #undef expr
10177
10178 #define expr declvalue(func_t)(declvalue(const bucket_t&))
10179 template<typename func_t> requires was_not_an_ill_form(expr)
10180 void for_each_bucket(func_t&&func)const noexcept_as(expr){
10181 _m.for_each(func);
10182 }
10183 #undef expr
10184 };
10185 template<typename T,template<typename>class stack_t,size_t _,size_t __>
10186 inline void swap(hash_table_t<T,stack_t,_>&a,hash_table_t<T,stack_t,__>&b)noexcept{a.swap(b);}
10187 template<typename T,template<typename>class stack_t,size_t _>
10188 inline void swap(hash_table_t<T,stack_t,_>&a,typename hash_table_t<T,stack_t,_>::base_t_w&b)noexcept{a.swap(b);}
10189 template<typename T,template<typename>class stack_t,size_t _>
10190 inline void swap(typename hash_table_t<T,stack_t,_>::base_t_w&b,hash_table_t<T,stack_t,_>&a)noexcept{a.swap(b);}
10191 }
10192
10193 //file_end
10194
10195 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/hash_table/_body.hpp"
10196 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/hash_table/_export.hpp"
10197 //_export.hpp
10198 //at namespace elc::defs::container
10199 /*
10200 未完成的elc解释器base文件
10201 由steve02081504与Alex0125设计、编写
10202 转载时请在不对此文件做任何修改的同时注明出处
10203 项目地址:https://github.com/steve02081504/ELC
10204 */
10205 #define export using hash_table_n::
10206 export hash_table_t;
10207 #undef export
10208
10209 //file_end
10210
10211 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/hash_table/_body.hpp"
10212 #if defined(ELC_TEST_ON)
10213 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/hash_table/_test.hpp"
10214 //_test.hpp
10215 //at namespace elc::defs::container
10216 /*
10217 未完成的elc解释器base文件
10218 由steve02081504与Alex0125设计、编写
10219 转载时请在不对此文件做任何修改的同时注明出处
10220 项目地址:https://github.com/steve02081504/ELC
10221 */
10222 namespace hash_table_n{
10223 //BLOCK:for debug
10224 inline void test(){
10225 ELC_TEST_EVENTNAME("hash_table部分测试");
10226 {
10227
10228 }
10229 check_memory_lack();
10230 }
10231 inline void test_log_out(){
10232 }
10233 inline void test_end(){
10234 }
10235 //BLOCK_END
10236 }
10237
10238 //file_end
10239
10240 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/hash_table/_body.hpp"
10241 #endif
10242
10243 //file_end
10244
10245 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/_body.hpp"
10246
10247 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/map/_body.hpp"
10248 //_body.hpp
10249 //at namespace elc::defs::container
10250 /*
10251 未完成的elc解释器base文件
10252 由steve02081504与Alex0125设计、编写
10253 转载时请在不对此文件做任何修改的同时注明出处
10254 项目地址:https://github.com/steve02081504/ELC
10255 */
10256 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/map/defs.hpp"
10257 //defs.hpp
10258 //at namespace elc::defs::container
10259 /*
10260 未完成的elc解释器base文件
10261 由steve02081504与Alex0125设计、编写
10262 转载时请在不对此文件做任何修改的同时注明出处
10263 项目地址:https://github.com/steve02081504/ELC
10264 */
10265 namespace map_n{
10266 template<typename T,typename key_t,template<typename>class stack_t=auto_stack_t,size_t bucket_max_size=256>
10267 class map_t{
10269
10270 struct data_t{
10271 key_t _key;
10272 T _value;
10273
10274 data_t(const data_t&) = default;
10275 data_t(const key_t&a,const T&b)noexcept(copy_construct.nothrow<key_t> && copy_construct.nothrow<T>):_key(a),_value(b){}
10276
10278 const T*_m;
10279 constexpr seek_value_t(const T&a):_m(addressof(a)){};
10280 [[nodiscard]]bool operator==(const data_t&a)const noexcept_as(a._value==*_m){
10281 return bool(a._value==*_m);
10282 }
10283 };
10284
10285 [[nodiscard]]bool operator==(const key_t&a)noexcept_as(_key==a){
10286 return bool(_key==a);
10287 }
10288 [[nodiscard]]constexpr_as(hash(_key))operator decltype(hash(_key))()const noexcept_as(hash(_key)){
10289 return hash(_key);
10290 }
10291 /* operator T&()noexcept{
10292 return _value;
10293 } */
10294 [[nodiscard]]bool empty(){
10295 return _value==const_default_value_of<T>;
10296 }
10297 };
10298 typedef hash_table_t<data_t,stack_t,bucket_max_size>base_t_w;
10299
10300 mutable base_t_w _m;//mutable cause shrink.
10301
10302 map_t(const base_t_w&a)noexcept:_m(a){}
10303 this_t copy()noexcept(copy_construct.nothrow<base_t_w>){
10304 return{_m};//不用疑惑,这是deep copy
10305 }
10306 public:
10307 map_t()noexcept=default;
10308 ~map_t()noexcept(destruct.nothrow<base_t_w>)=default;
10309 map_t(const this_t&a)noexcept=default;
10310 map_t(this_t&&a)noexcept=default;
10311
10312 this_t&operator=(this_t&&a)noexcept{
10313 swap(_m,a._m);
10314 return*this;
10315 }
10316 this_t&operator=(const this_t&a)noexcept{
10317 return operator=(a.copy());
10318 }
10319
10320 template<size_t _>
10321 void swap(map_t<T,key_t,stack_t,_>&a)noexcept{swap(_m,a._m);}
10322
10323 [[nodiscard]]T&operator[](const key_t&a)noexcept_as(_m.add({a,T()})){
10324 auto tmp=_m.find(a);
10325 if(tmp.fail()){
10326 _m.add({a,T()});
10327 tmp=_m.find(a);
10328 }
10329 return tmp.get_ref()._value;
10330 }
10331 [[nodiscard]]const T&operator[](const key_t&a)const noexcept{
10332 auto tmp=_m.find(a);
10333 return tmp.fail()?const_default_value_of<T>:tmp.get_ref()._value;
10334 }
10335 void clear()noexcept(re_construct.nothrow<this_t>){
10336 re_construct(this);
10337 }
10338
10339 #define expr declvalue(func_t)(declvalue(T&))
10340 template<typename func_t> requires was_not_an_ill_form(expr)
10341 void for_each(func_t&&func)noexcept_as(expr){
10342 _m.for_each(lambda(data_t&a)noexcept_as(expr){
10343 func(a._value);
10344 });
10345 }
10346 #undef expr
10347
10348 #define expr declvalue(func_t)(declvalue(const T&))
10349 template<typename func_t> requires was_not_an_ill_form(expr)
10350 void for_each(func_t&&func)const noexcept_as(expr){
10351 _m.for_each(lambda(data_t&a)noexcept_as(expr){
10352 func(add_const<T&>(a._value));
10353 });
10354 }
10355 #undef expr
10356
10357 static constexpr bool shrink_nothow=stack_t<data_t>::remove_nothrow;
10358 void shrink()const noexcept(shrink_nothow){
10359 _m.for_each_bucket(lambda(stack_t<data_t>&a)noexcept(shrink_nothow && equal.nothrow<T>){
10360 while(a.remove(data_t::seek_value_t(const_default_value_of<T>)));
10361 });
10362 }
10363
10364 using_method_from_value(size,_m,const);
10365
10366 bool operator==(const this_t&a)const noexcept(shrink_nothow && equal.nothrow<T>){
10367 shrink();
10368 a.shrink();
10369 if(size()!=a.size())
10370 return 0;
10371 try{
10372 _m.for_each(lambda_with_catch(&a)(data_t&b){
10373 if(a[b._key]!=b._value)
10374 throw (this_t*)(nullptr);
10375 });
10376 }
10377 catch(this_t*){
10378 return 0;
10379 }
10380 return 1;
10381 }
10382 };
10383 template<typename T,typename key_t,template<typename>class stack_t,size_t _,size_t __>
10384 inline void swap(map_t<T,key_t,stack_t,_>&a,map_t<T,key_t,stack_t,__>&b)noexcept{a.swap(b);}
10385 }
10386
10387 //file_end
10388
10389 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/map/_body.hpp"
10390 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/map/_export.hpp"
10391 //_export.hpp
10392 //at namespace elc::defs::container
10393 /*
10394 未完成的elc解释器base文件
10395 由steve02081504与Alex0125设计、编写
10396 转载时请在不对此文件做任何修改的同时注明出处
10397 项目地址:https://github.com/steve02081504/ELC
10398 */
10399 #define export using map_n::
10400 export map_t;
10401 #undef export
10402
10403 //file_end
10404
10405 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/map/_body.hpp"
10406 #if defined(ELC_TEST_ON)
10407 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/map/_test.hpp"
10408 //_test.hpp
10409 //at namespace elc::defs::container
10410 /*
10411 未完成的elc解释器base文件
10412 由steve02081504与Alex0125设计、编写
10413 转载时请在不对此文件做任何修改的同时注明出处
10414 项目地址:https://github.com/steve02081504/ELC
10415 */
10416 namespace map_n{
10417 //BLOCK:for debug
10418 inline void test(){
10419 ELC_TEST_EVENTNAME("map部分测试");
10420 {
10421
10422 }
10423 check_memory_lack();
10424 }
10425 inline void test_log_out(){
10426 }
10427 inline void test_end(){
10428 }
10429 //BLOCK_END
10430 }
10431
10432 //file_end
10433
10434 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/map/_body.hpp"
10435 #endif
10436
10437 //file_end
10438
10439 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/_body.hpp"
10440
10441 #if defined(ELC_TEST_ON)
10442 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/_test.hpp"
10443 //_test.hpp
10444 //at namespace elc::defs::container
10445 /*
10446 未完成的elc解释器base文件
10447 由steve02081504与Alex0125设计、编写
10448 转载时请在不对此文件做任何修改的同时注明出处
10449 项目地址:https://github.com/steve02081504/ELC
10450 */
10451 inline void test(){
10452 ELC_TEST_EVENTNAME("container部分测试");
10453 array_n::test();
10454 function_n::test();
10455 stack_n::test();
10456 }
10457 inline void test_log_out(){
10458 array_n::test_log_out();
10459 function_n::test_log_out();
10460 stack_n::test_log_out();
10461 }
10462 inline void test_end(){
10463 array_n::test_end();
10464 function_n::test_end();
10465 stack_n::test_end();
10466 }
10467
10468 //file_end
10469
10470 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/container/_body.hpp"
10471 #endif
10472
10473 //file_end
10474
10475 #line 35 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
10476 }
10477 using namespace container;
10478
10479 namespace memory::gc_n{//gc定义,依赖container(但container依赖memory的其他部分)
10480 //依赖container
10481 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_body.hpp"
10482 //_body.hpp
10483 //at namespace elc::defs::memory::gc_n
10484 /*
10485 未完成的elc解释器base文件
10486 由steve02081504与Alex0125设计、编写
10487 转载时请在不对此文件做任何修改的同时注明出处
10488 项目地址:https://github.com/steve02081504/ELC
10489 */
10490 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_flags/_body.hpp"
10491 //_body.hpp
10492 //at namespace elc::defs::memory::gc_n
10493 /*
10494 未完成的elc解释器base文件
10495 由steve02081504与Alex0125设计、编写
10496 转载时请在不对此文件做任何修改的同时注明出处
10497 项目地址:https://github.com/steve02081504/ELC
10498 */
10499 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_flags/roots/_body.hpp"
10500 //_body.hpp
10501 //at namespace elc::defs::memory::gc_n
10502 /*
10503 未完成的elc解释器base文件
10504 由steve02081504与Alex0125设计、编写
10505 转载时请在不对此文件做任何修改的同时注明出处
10506 项目地址:https://github.com/steve02081504/ELC
10507 */
10508 struct have_root{};
10509
10510 template<typename T>
10511 class root_of;
10512
10513 template<typename T>
10514 class roots_t{
10515 typedef roots_t<T>this_t;
10516 typedef root_of<T>root_t;
10517 typedef root_of<T>*value_t;
10518
10519 base_stack_t<value_t>_roots;
10520 public:
10521 constexpr roots_t()noexcept=default;
10522 ~roots_t()noexcept=default;
10523
10524 using_method_from_value(map,_roots);
10525 using_method_from_value(add,_roots);
10526 using_method_from_value(remove,_roots);
10527 using_method_from_value(for_each,_roots);
10528
10529 void map_and_mark()noexcept_as(declvalue(value_t)->map_and_mark()){
10530 _roots.for_each(
10531 lambda(value_t&a)noexcept_as(a->map_and_mark())
10532 {
10533 a->map_and_mark();
10534 }
10535 );
10536 }
10537 };
10538 template<typename T>
10539 distinctive inline roots_t<T>roots_of{};
10540
10541 template<typename T>
10542 class root_of{
10543 typedef root_of<T>this_t;
10544 public:
10545 root_of()noexcept_as(roots_of<T>.add(declvalue(this_t*))){
10546 roots_of<T>.add(this);
10547 }
10548 virtual T& get()noexcept=0;
10549 virtual void map_and_mark()noexcept=0;
10550 };
10551 template<typename T>
10552 inline T& root_of<T>::get()noexcept{return const_default_value_of<T>;}
10553 template<typename T>
10554 inline void root_of<T>::map_and_mark()noexcept{}
10555
10556 //file_end
10557
10558 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_flags/_body.hpp"
10559 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_flags/mark_able_for_gc/_body.hpp"
10560 //_body.hpp
10561 //at namespace elc::defs::memory::gc_n
10562 /*
10563 未完成的elc解释器base文件
10564 由steve02081504与Alex0125设计、编写
10565 转载时请在不对此文件做任何修改的同时注明出处
10566 项目地址:https://github.com/steve02081504/ELC
10567 */
10568 template<typename T>
10570 mark_able_for_gc()noexcept:mark_able<T>(not_mark){}
10571 mark_able_for_gc(const mark_able_for_gc&)noexcept{}
10572 };
10573
10574 //file_end
10575
10576 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_flags/_body.hpp"
10577 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_flags/others/_body.hpp"
10578 //_body.hpp
10579 //at namespace elc::defs::memory::gc_n
10580 /*
10581 未完成的elc解释器base文件
10582 由steve02081504与Alex0125设计、编写
10583 转载时请在不对此文件做任何修改的同时注明出处
10584 项目地址:https://github.com/steve02081504/ELC
10585 */
10586 def_common_attribute_with_nothing(can_shrink);
10587 def_common_attribute_with_nothing(can_map_all);
10588
10589 //file_end
10590
10591 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_flags/_body.hpp"
10592
10593 //file_end
10594
10595 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_body.hpp"
10596
10597 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_t/_body.hpp"
10598 //_body.hpp
10599 //at namespace elc::defs::memory::gc_n
10600 /*
10601 未完成的elc解释器base文件
10602 由steve02081504与Alex0125设计、编写
10603 转载时请在不对此文件做任何修改的同时注明出处
10604 项目地址:https://github.com/steve02081504/ELC
10605 */
10606 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_t/default_method/decl.hpp"
10607 //_body.hpp
10608 //at namespace elc::defs::memory::gc_n
10609 /*
10610 未完成的elc解释器base文件
10611 由steve02081504与Alex0125设计、编写
10612 转载时请在不对此文件做任何修改的同时注明出处
10613 项目地址:https://github.com/steve02081504/ELC
10614 */
10615 template<class T,enable_flag>
10616 inline void gc_method_of()noexcept;
10617 template<class T,enable_flag>
10618 [[nodiscard]]inline bool gc_success_identifier_of()noexcept;
10619
10620 //file_end
10621
10622 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_t/_body.hpp"
10623 //
10624 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_t/defs.hpp"
10625 //defs.hpp
10626 //at namespace elc::defs::memory
10627 /*
10628 未完成的elc解释器base文件
10629 由steve02081504与Alex0125设计、编写
10630 转载时请在不对此文件做任何修改的同时注明出处
10631 项目地址:https://github.com/steve02081504/ELC
10632 */
10633 class gc_t{
10634 typedef gc_t this_t;
10635 typedef function_t<void()noexcept>gc_method_t;
10636 typedef function_t<bool()noexcept>success_identifier_t;
10637
10638 base_stack_t<gc_method_t>_gc_methods;
10639 base_stack_t<success_identifier_t>_gc_success_identifiers;
10640 mutable flag _gc_running=flag(not_set);
10641 public:
10642 inline void operator()()const noexcept{
10643 if(_gc_running)
10644 die_with(locale::str::gc_fail);
10645 _gc_running.set();
10646 if(_gc_methods.empty())
10647 die_with(locale::str::empty_gc_method);
10648 _gc_methods.for_each(invoke<const gc_method_t>._as(nothing));
10649 _gc_running.unset();
10650 }
10651 [[nodiscard]]inline bool success()const noexcept{
10652 bool success=_gc_success_identifiers.empty();
10653 _gc_success_identifiers.for_each(
10654 lambda_with_catch(&success)(const success_identifier_t&a)noexcept{
10655 if(not success)
10656 success=a();
10657 }
10658 );
10659 return success;
10660 }
10661
10662 inline void add_gc_method(gc_method_t a)noexcept{
10663 _gc_methods.add(a);
10664 }
10665 inline void remove_gc_method(gc_method_t a){
10666 _gc_methods.remove(a);
10667 }
10668
10669 inline void add_gc_success_identifier(success_identifier_t a)noexcept{
10670 _gc_success_identifiers.add(a);
10671 }
10672 inline void remove_gc_success_identifier(success_identifier_t a){
10673 _gc_success_identifiers.remove(a);
10674 }
10675
10676 template<class T>
10677 inline void add_gc_method(type_info_t<T>)noexcept{
10678 add_gc_method((void(*)()noexcept)gc_method_of<T>);
10679 add_gc_success_identifier(gc_success_identifier_of<T>);
10680 }
10681 template<class T>
10682 inline void remove_gc_method(type_info_t<T>)noexcept{
10683 remove_gc_method(gc_method_of<T>);
10684 remove_gc_success_identifier(gc_success_identifier_of<T>);
10685 }
10686 };
10687
10688 //file_end
10689
10690 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_t/_body.hpp"
10691 //
10692 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_t/default_method/defs.hpp"
10693 //_body.hpp
10694 //at namespace elc::defs::memory::gc_n
10695 /*
10696 未完成的elc解释器base文件
10697 由steve02081504与Alex0125设计、编写
10698 转载时请在不对此文件做任何修改的同时注明出处
10699 项目地址:https://github.com/steve02081504/ELC
10700 */
10701 namespace default_gc_for_type{
10702 template<class T,enable_if(type_info<T>.has_attribute(count_able))>
10703 distinctive inline size_t count_for_success_identify;
10704
10705 template<class T>
10706 constexpr bool use_default_gc_able =
10707 (
10708 type_info<T>.has_attribute(mark_able_for_gc) &&
10709 type_info<T>.has_attribute(have_root)
10710 )&&(
10711 type_info<T>.has_attribute(can_map_all)
10712 &&(
10713 type_info<T>.has_attribute(can_shrink)
10714 ||(
10715 type_info<T>.has_attribute(mark_able_for_gc) &&
10716 type_info<T>.has_attribute(have_root)
10717 )
10718 )
10719 );
10720
10721 enable_adl(destory_by_gc);
10722 template<class T>
10723 void destory_by_gc(T*){
10724 template_error("this function should not be instantiated,please overload the function destory_by_gc in the namespace where this type is defined.");
10725 }
10726
10727 template<class T> requires use_default_gc_able<T>
10728 inline void default_gc_method()noexcept{
10729 constexpr auto&info=type_info<T>;
10730 //
10731 if constexpr(info.has_attribute(count_able))
10732 count_for_success_identify<T> = the_number_of(info);
10733 //
10734 if constexpr(info.has_attribute(can_map_all)){
10735 if constexpr(info.has_attribute(mark_able_for_gc)&&info.has_attribute(have_root))
10736 roots_of<T>.map_and_mark();
10737 if constexpr(info.has_attribute(can_shrink) || (info.has_attribute(mark_able_for_gc)&&info.has_attribute(have_root)))
10738 map_all<T>(
10739 lambda(T*a)noexcept{
10740 if constexpr(info.has_attribute(can_shrink))
10741 a->shrink();
10742 if constexpr(info.has_attribute(mark_able_for_gc)&&info.has_attribute(have_root)){
10743 auto& b=attribute_cast<mark_able_for_gc>(*a);
10744 if(b.was_marked())
10745 b.unmark();
10746 else
10747 destory_by_gc(a);
10748 }
10749 }
10750 );
10751 }
10752 }
10753 //
10754 template<class T>
10755 constexpr bool use_default_gc_success_identifier_able = type_info<T>.has_attribute(count_able);
10756
10757 template<class T> requires use_default_gc_success_identifier_able<T>
10758 [[nodiscard]]inline bool default_gc_success_identifier()noexcept{
10759 constexpr auto&info=type_info<T>;
10760 if constexpr(info.has_attribute(count_able)){//重复判定,勿删,方便日后扩展
10761 return count_for_success_identify<T> _big_than_ the_number_of(info);
10762 }
10763 }
10764 }
10765 template<class T,enable_if(default_gc_for_type::use_default_gc_able<T>)>
10766 inline void gc_method_of()noexcept{
10767 default_gc_for_type::default_gc_method<T>();
10768 }
10769 template<class T,enable_if(default_gc_for_type::use_default_gc_success_identifier_able<T>)>
10770 [[nodiscard]]inline bool gc_success_identifier_of()noexcept{
10771 return default_gc_for_type::default_gc_success_identifier<T>();
10772 }
10773
10774 //file_end
10775
10776 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_t/_body.hpp"
10777
10778 //file_end
10779
10780 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_body.hpp"
10781
10782 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/defs.hpp"
10783 //defs.hpp
10784 //at namespace elc::defs::memory::gc_n
10785 /*
10786 未完成的elc解释器base文件
10787 由steve02081504与Alex0125设计、编写
10788 转载时请在不对此文件做任何修改的同时注明出处
10789 项目地址:https://github.com/steve02081504/ELC
10790 */
10791 distinctive inline gc_t gc;
10792
10793 //file_end
10794
10795 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_body.hpp"
10796
10797 //for alloc (def in "../alloc/defs.hpp#L10" )
10798 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/gc_for_alloc/_body.hpp"
10799 //_body.hpp
10800 //at namespace elc::defs::memory::gc_n
10801 /*
10802 未完成的elc解释器base文件
10803 由steve02081504与Alex0125设计、编写
10804 转载时请在不对此文件做任何修改的同时注明出处
10805 项目地址:https://github.com/steve02081504/ELC
10806 */
10807 inline void gc_for_alloc()noexcept{
10808 gc();
10809 }
10810
10811 //file_end
10812
10813 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_body.hpp"
10814 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/root_ptr/_body.hpp"
10815 //_body.hpp
10816 //at namespace elc::defs::memory::gc_n
10817 /*
10818 未完成的elc解释器base文件
10819 由steve02081504与Alex0125设计、编写
10820 转载时请在不对此文件做任何修改的同时注明出处
10821 项目地址:https://github.com/steve02081504/ELC
10822 */
10823 BREAK_NAMESPACE//in namespace elc::defs
10824 INTER_NAMESPACE(memory::ptr_n)
10825
10826 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/root_ptr/defs.hpp"
10827 //defs.hpp
10828 //at namespace elc::defs::memory::ptr_n
10829 /*
10830 未完成的elc解释器base文件
10831 由steve02081504与Alex0125设计、编写
10832 转载时请在不对此文件做任何修改的同时注明出处
10833 项目地址:https://github.com/steve02081504/ELC
10834 */
10835 enable_adl(map_and_mark_for_gc);
10836 template<typename T>
10837 void map_and_mark_for_gc(T*)noexcept{
10838 template_error("this function should not be instantiated,please overload the function map_and_mark_for_gc in the namespace where this type is defined");
10839 }
10840 using ::elc::defs::memory::gc_n::root_of;
10841 template<class T,enable_if(
10842 was_ref_able<T> &&
10843 comn_ptr_t<T>::replace_check_nothrow &&
10844 type_info<T>.has_attribute(gc_n::have_root)
10845 )>
10846 struct root_ptr_t:comn_ptr_t<T>,root_of<T>{
10847 typedef comn_ptr_t<T>base_t;
10848 typedef root_ptr_t<T>this_t;
10849 public:
10850 using base_t::base_t;
10851 template<class assign_t> requires was_not_an_ill_form(declvalue(base_t)=declvalue(assign_t))
10852 this_t&operator=(assign_t&&a)noexcept_as(base_t::operator=(forward<assign_t>(a))){
10853 base_t::operator=(forward<assign_t>(a));
10854 return*this;
10855 }
10856 virtual T& get()noexcept override{
10857 return base_t::operator*();
10858 }
10859 virtual void map_and_mark()noexcept override{
10860 map_and_mark_for_gc(&**this);
10861 }
10862 };
10863
10864 //file_end
10865
10866 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/root_ptr/_body.hpp"
10867 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/root_ptr/deduction_guides.hpp"
10868 //deduction_guides.hpp
10869 //at namespace elc::defs::memory::ptr_n
10870 /*
10871 未完成的elc解释器base文件
10872 由steve02081504与Alex0125设计、编写
10873 转载时请在不对此文件做任何修改的同时注明出处
10874 项目地址:https://github.com/steve02081504/ELC
10875 */
10876 template<class T>
10878
10879 //file_end
10880
10881 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/root_ptr/_body.hpp"
10882
10883 BREAK_NAMESPACE//in namespace elc::defs
10884
10885 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/root_ptr/_export.hpp"
10886 //_export.hpp
10887 //at namespace elc::defs
10888 /*
10889 未完成的elc解释器base文件
10890 由steve02081504与Alex0125设计、编写
10891 转载时请在不对此文件做任何修改的同时注明出处
10892 项目地址:https://github.com/steve02081504/ELC
10893 */
10894 INTER_NAMESPACE(memory)
10895 #define export using memory::ptr_n::
10896 export root_ptr_t;
10897 #undef export
10898 BREAK_NAMESPACE
10899
10900 //file_end
10901
10902 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/root_ptr/_body.hpp"
10903
10904 INTER_NAMESPACE(memory::gc_n)
10905
10906 //file_end
10907
10908 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_body.hpp"
10909
10910 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_export.hpp"
10911 //_export.hpp
10912 //at namespace elc::defs::memory::gc_n
10913 /*
10914 未完成的elc解释器base文件
10915 由steve02081504与Alex0125设计、编写
10916 转载时请在不对此文件做任何修改的同时注明出处
10917 项目地址:https://github.com/steve02081504/ELC
10918 */
10919 BREAK_NAMESPACE//in namespace elc::defs
10920 INTER_NAMESPACE(memory)
10921 #define export using gc_n::
10922 export gc;
10923 export have_root;
10924 export root_of;
10925 export mark_able_for_gc;
10926 export can_shrink;
10927 #undef export
10928 BREAK_NAMESPACE//in namespace elc::defs
10929 INTER_NAMESPACE(memory::gc_n)
10930
10931 //file_end
10932
10933 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_body.hpp"
10934
10935 #if defined(ELC_TEST_ON)
10936 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_test.hpp"
10937 //_body.hpp
10938 //at namespace elc::defs::memory::gc_n
10939 /*
10940 未完成的elc解释器base文件
10941 由steve02081504与Alex0125设计、编写
10942 转载时请在不对此文件做任何修改的同时注明出处
10943 项目地址:https://github.com/steve02081504/ELC
10944 */
10945 #if!defined(_MSC_VER)//貌似msvc在这里有bug
10946 struct gc_tester:type_info_t<gc_tester>::template_name
10947 with_common_attribute<can_map_all,can_shrink,count_able,mark_able_for_gc,never_in_array,ref_able>,
10949 distinctive static inline int shrink_time=0;
10950 distinctive static inline int destroy_time=0;
10951 ~gc_tester()noexcept{destroy_time++;}
10952 void shrink(){
10953 shrink_time++;
10954 }
10955 static void reset_times(){
10956 shrink_time=destroy_time=0;
10957 }
10958 };
10959 static_assert(type_info<gc_tester>.base_on<can_map_all<gc_tester>>);
10960 void map_and_mark_for_gc(gc_tester*a){
10961 attribute_ptr_cast<mark_able_for_gc>(a)->mark();
10962 }
10963 void destory_by_gc(gc_tester*a){
10964 a->~gc_tester();
10965 }
10966 #endif
10967 inline void test(){
10968 #if!defined(_MSC_VER)
10969 ELC_TEST_EVENTNAME("gc部分测试");
10970 using ::std::time;
10971 using ::std::rand;
10972 using ::std::srand;
10973 srand((unsigned)time(nullptr));
10974 gc.add_gc_method(type_info<gc_tester>);
10975 for(int t=rand()%7;t--;)
10976 {
10977 int i;
10978 root_ptr_t<gc_tester> name=get<gc_tester>();
10979 for(i=rand()%72;i--;){
10980 #pragma warning(suppress: 4189)
10981 auto p=get<gc_tester>();
10982 }
10983 gc();
10984 stest_accert(gc_tester::shrink_time==i+1);
10985 stest_accert(gc_tester::destroy_time==i);
10986 stest_accert(get_size_of_get(&*name)==1);
10987 }
10988 check_memory_lack();
10989 #endif
10990 }
10991 inline void test_log_out(){
10992
10993 }
10994 inline void test_end(){
10995
10996 }
10997
10998 //file_end
10999
11000 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/memory/gc/_body.hpp"
11001 #endif
11002
11003 //file_end
11004
11005 #line 40 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
11006 }
11007 using namespace memory;//只是强迫症
11008
11009 #if defined(ELC_TEST_ON)
11010 namespace base_part_test{
11011 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_test.hpp"
11012 //_test.hpp
11013 //at namespace elc::defs::base_part_test
11014 /*
11015 未完成的elc解释器base文件
11016 由steve02081504与Alex0125设计、编写
11017 转载时请在不对此文件做任何修改的同时注明出处
11018 项目地址:https://github.com/steve02081504/ELC
11019 */
11020 inline void test(){
11021 ELC_TEST_EVENTNAME("base部分测试");
11022 memory::test();
11023 container::test();
11024 gc_n::test();
11025 }
11026 inline void test_log_out(){
11027 memory::test_log_out();
11028 container::test_log_out();
11029 }
11030 inline void test_end(){
11031 memory::test_end();
11032 container::test_end();
11033 }
11034
11035 //file_end
11036
11037 #line 46 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
11038 }
11039 #endif
11040
11041 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
11042 //_undefs.hpp
11043 /*
11044 未完成的elc解释器basic文件
11045 由steve02081504与Alex0125设计、编写
11046 转载时请在不对此文件做任何修改的同时注明出处
11047 项目地址:https://github.com/steve02081504/ELC
11048 */
11049 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
11050 //_undefs.hpp
11051 /*
11052 未完成的elc解释器_share文件
11053 由steve02081504与Alex0125设计、编写
11054 转载时请在不对此文件做任何修改的同时注明出处
11055 项目地址:https://github.com/steve02081504/ELC
11056 */
11057
11058 //defs at "_defs.hpp"
11059
11060 #if defined(_MSC_VER)
11061 #pragma warning(pop)
11062 #endif
11063 #undef suppress_msvc_warning
11064 #undef disable_msvc_warning
11065 #undef push_msvc_warning
11066 #undef pop_msvc_warning
11067 #undef push_and_disable_msvc_warning
11068
11069 //for basic_environment.hpp
11070 #undef BIT_POSSIBILITY
11071 //
11072 #if defined(ELC_VOID_NAME)
11073 #define void the_void
11074 #endif
11075
11076 // #undef often_noexcept
11077 #undef noexcept_as
11078 #undef noexcept_as_auto
11079 #undef constexpr_as
11080 #undef constexpr_as_auto
11081
11082 #undef using_method_from_base_t
11083 #undef using_method_from_value
11084
11085 #undef floop
11086 #undef enable_adl
11087
11088 #undef re_declvalue
11089 #undef re_decltype
11090
11091 #undef declvalue
11092
11093 #undef template_error
11094 #undef template_warning
11095
11096 #undef type_info_of
11097 #undef type_name_of
11098
11099 #undef is_common_attribute
11100 #undef is_special_attribute
11101
11102 #undef has_attribute
11103 #undef not_has_attribute
11104
11105 #undef float_size_of
11106 #undef bitnum_of
11107
11108 #undef def_common_attribute_with_nothing
11109 #undef def_special_attribute_with_nothing
11110
11111 #undef common_attribute_t
11112 #undef special_attribute_t
11113
11114 #undef enable_if
11115 #undef enabled_by_default
11116 #undef disabled_by_default
11117 #undef enable_if_not_ill_form
11118 #undef enable_flag
11119
11120 #undef was_an_ill_form
11121 #undef was_an_ill_form_with_parameter
11122 #undef was_not_an_ill_form
11123 #undef was_not_an_ill_form_and_noexcept
11124 #undef was_not_an_ill_form_with_parameter
11125
11126 #undef recursive_lambda
11127 #undef get_recursive_lambda_caller
11128 #undef lambda
11129 #undef lambda_with_catch
11130 #undef self_recursion
11131 #undef lambda_RLSRRS
11132
11133 #undef MAGIC
11134
11135 #undef nothing
11136
11137 #undef elseif
11138 #undef _big_than_
11139 #undef _small_than_
11140
11141 #if defined(_MSC_VER)
11142 #undef not
11143 #undef and
11144 #undef or
11145 #endif
11146
11147 #undef INTER_NAMESPACE
11148 #undef BREAK_NAMESPACE
11149
11150 #undef szie
11151 #undef form
11152
11153 #undef template_name
11154 #undef type_name
11155
11156 #undef not_in_debug
11157
11158 #undef es
11159 #undef ec
11160
11161 #undef ELC_TEST_EVENTNAME
11162
11163 #undef override_instance_struct
11164
11165 #undef distinctive
11166
11167 #undef force_inline
11168
11169 #undef with_no_vtable
11170
11171 #undef in_consteval
11172
11173 #undef no_vtable_struct
11174 #undef no_vtable_class
11175
11176 //file_end
11177
11178 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
11179
11180 //file_end
11181
11182 #line 50 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
11183 }
11184 namespace elc{
11185 //导出base承诺于名称空间elc中提供的内容
11186 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_export.hpp"
11187 //_export.hpp
11188 //at namespace elc
11189 /*
11190 未完成的elc解释器base文件
11191 由steve02081504与Alex0125设计、编写
11192 转载时请在不对此文件做任何修改的同时注明出处
11193 项目地址:https://github.com/steve02081504/ELC
11194 */
11195 #define export using defs::base::
11196 #undef export
11197
11198 //file_end
11199
11200 #line 53 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base/_body.hpp"
11201 }
11202
11203 //file_end
11204
11205 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
11206 #endif
11207
11208 //file_end
11209
11210 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
11211 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
11212 //base_defs
11213 //at namespace ::
11214 /*
11215 未完成的elc解释器include文件
11216 由steve02081504与Alex0125设计、编写
11217 转载时请在不对此文件做任何修改的同时注明出处
11218 项目地址:https://github.com/steve02081504/ELC
11219 */
11220 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
11221
11222 //file_end
11223
11224 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
11225 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_exception"
11226 //base_exception
11227 //at namespace ::
11228 /*
11229 未完成的elc解释器include文件
11230 由steve02081504与Alex0125设计、编写
11231 转载时请在不对此文件做任何修改的同时注明出处
11232 项目地址:https://github.com/steve02081504/ELC
11233 */
11234 #if !defined(ELC_BASE_EXCEPTION)
11235 #define ELC_BASE_EXCEPTION
11236 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
11237 //using.hpp
11238 /*
11239 未完成的elc解释器_share文件
11240 由steve02081504与Alex0125设计、编写
11241 转载时请在不对此文件做任何修改的同时注明出处
11242 项目地址:https://github.com/steve02081504/ELC
11243 */
11244 /*
11245 locale说明
11246 elc使用的字符串.
11247 调整这些,实现快速本地化.
11248 */
11249 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
11250
11251 //file_end
11252
11253 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_exception"
11254 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_body.hpp"
11255 //_body.hpp
11256 //at namespace ::
11257 /*
11258 未完成的elc解释器base_exception文件
11259 由steve02081504与Alex0125设计、编写
11260 转载时请在不对此文件做任何修改的同时注明出处
11261 项目地址:https://github.com/steve02081504/ELC
11262 */
11263 #if defined(ELC_TEST)
11264 #error "this part cannot be tested."
11265 #endif
11266 //char_t
11267 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/default_data_type.hpp"
11268 //default_data_type.hpp
11269 /*
11270 未完成的elc解释器_share文件
11271 由steve02081504与Alex0125设计、编写
11272 转载时请在不对此文件做任何修改的同时注明出处
11273 项目地址:https://github.com/steve02081504/ELC
11274 */
11275 namespace elc{
11276 /*ELC内部string统一采用char_t宽字符,使用setlocale(LC_ALL,"en_US.utf8")下的UTF编码。*/
11277 typedef char32_t char_t;
11278 /*ELC内部钦定int_t类型*/
11279 typedef int64_t int_t;
11280 /*ELC内部钦定uint_t类型*/
11281 typedef uint64_t uint_t;
11282 /*ELC内部钦定float_t类型*/
11283 typedef double float_t;
11284 /*ELC内部钦定float_size_t类型,用以描述内存大小的浮点状况*/
11285 typedef long double float_size_t;
11286 }
11287
11288 //file_end
11289
11290 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_body.hpp"
11291 namespace elc::defs{
11292 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
11293 //_defs.hpp
11294 /*
11295 未完成的elc解释器basic文件
11296 由steve02081504与Alex0125设计、编写
11297 转载时请在不对此文件做任何修改的同时注明出处
11298 项目地址:https://github.com/steve02081504/ELC
11299 */
11300 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
11301 //_defs.hpp
11302 /*
11303 未完成的elc解释器_share文件
11304 由steve02081504与Alex0125设计、编写
11305 转载时请在不对此文件做任何修改的同时注明出处
11306 项目地址:https://github.com/steve02081504/ELC
11307 */
11308
11309 //undefs at "_undefs.hpp"
11310
11311 //set ELC_WARNING_LEVEL default to 4(max)
11312 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
11313
11314 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
11315 //basic_environment.hpp
11316 /*
11317 未完成的elc解释器_share文件
11318 由steve02081504与Alex0125设计、编写
11319 转载时请在不对此文件做任何修改的同时注明出处
11320 项目地址:https://github.com/steve02081504/ELC
11321 */
11322
11323 //每个bit(不是字节)的可能性
11324 //为什么c艹委员会不定义这个?
11325 #define BIT_POSSIBILITY 2
11326
11327 //file_end
11328
11329 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
11330
11331 #if defined(_MSC_VER)
11332 #pragma warning(push,ELC_WARNING_LEVEL)
11333 #pragma warning(disable:4099)//class与struct混用警告diss
11334 #pragma warning(disable:26812)//enum class安利diss.
11335 #pragma warning(disable:4584)//重复子类警告diss
11336 #pragma warning(disable:4250)//域控制继承警告diss
11337 #pragma warning(disable:26432)//不完全默认方法警告diss
11338 #pragma warning(disable:26435)//virtual override方法警告diss
11339 #pragma warning(disable:26481)//容器安利diss
11340 #pragma warning(disable:26446)//gsl::at安利diss
11341 #pragma warning(disable:26434)//方法覆盖警告diss
11342 #pragma warning(disable:26429)//gsl::not_null安利diss
11343 #pragma warning(disable:26471)//对void*进行static_cast安利diss
11344 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
11345 #pragma warning(disable:26473)//相同指针显式cast警告diss
11346 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
11347 #pragma warning(disable:26485)//数组作指针警告diss
11348 #pragma warning(disable:26490)//reinterpret_cast警告diss
11349 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
11350 #pragma warning(disable:26482)//非常数数组索引警告diss
11351 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
11352 #endif
11353 #if defined(_MSC_VER)
11354 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
11355 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
11356 #define push_msvc_warning() __pragma(warning(push))
11357 #define pop_msvc_warning() __pragma(warning(pop))
11358 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
11359 #else
11360 #define suppress_msvc_warning(...)
11361 #define disable_msvc_warning(...)
11362 #define push_msvc_warning()
11363 #define pop_msvc_warning()
11364 #define push_and_disable_msvc_warning(...)
11365 #endif
11366 //
11367 #if defined(ELC_VOID_NAME)
11368 #undef void
11369 #endif
11370
11371 // #define often_noexcept
11372 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
11373 #define noexcept_as_auto MAGIC//哦现在有了
11374 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
11375 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
11376
11377 #define using_method_from_base_t(name,...) \
11378 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
11379 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
11380 {\
11381 return base_t::name(forward<Args>(rest)...);\
11382 }\
11383
11384 #define using_method_from_value(name,value_name,...) \
11385 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
11386 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
11387 {\
11388 return value_name.name(forward<Args>(rest)...);\
11389 }\
11390
11391 #define floop while(__builtin_is_my_dick_still_there())
11392 #define enable_adl(name) void name()noexcept=delete
11393
11394 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
11395 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
11396
11397 #define declvalue(...) (::std::declval<__VA_ARGS__>())
11398
11399 /*实例化到此将引发错误*/
11400 #define template_error(reason) static_assert(template_error_helper<T>,reason)
11401 /*实例化到此将引发警告*/
11402 #define template_warning(reason) template_warning_helper<T>(reason)
11403
11404 //for type_info
11405 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
11406 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
11407
11408 #define is_common_attribute(name) public attribute<T,name<T>>
11409 #define is_special_attribute(name) public attribute<T,name>
11410
11411 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
11412 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
11413
11414 //for float_size_t
11415 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
11416 //bitnum_of
11417 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
11418
11419 //for attribute
11420 #define def_common_attribute_with_nothing(name) \
11421 template<typename T>\
11422 class name{}\
11423
11424 #define def_special_attribute_with_nothing(name) \
11425 class name{}\
11426
11427 #define common_attribute_t template<class>class
11428 #define special_attribute_t class
11429
11430 /*
11431 若参数的布尔值为零,那么此模板不会实例化
11432
11433 为什么不用cpp20的constraints?
11434 1.不能类内定义
11435 2.不能作为模板参数
11436 一句话总结:c艹标准会sb
11437 */
11438 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
11439 /*默认参与模板候选*/
11440 #define enabled_by_default class enable_state=void
11441 /*默认不参与模板候选*/
11442 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
11443 /*若参数为病式,那么此模板不会实例化*/
11444 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
11445 /*用于模板声明*/
11446 #define enable_flag class enable_state
11447
11448 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
11449 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
11450 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
11451 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
11452 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
11453
11454 /*让lambda递归更加美观*/
11455 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
11456 /*让lambda递归更加美观*/
11457 #define get_recursive_lambda_caller(name) \
11458 lambda_with_catch(&)(auto&&...Args){\
11459 return name(name,Args...);\
11460 }
11461 /*让lambda定义更加美观*/
11462 #define lambda []
11463 /*让lambda定义更加美观*/
11464 #define lambda_with_catch(...) [__VA_ARGS__]
11465 /*让lambda递归更加美观*/
11466 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
11467 //recursive_lambda_self_referential_reserved_symbolname
11468 #define lambda_RLSRRS _my_jb_super_sb_name_
11469
11470 #define MAGIC//ahh,ko no tenno da!
11471
11472 /*装饰性语法糖*/
11473 #define nothing
11474
11475 /*aya风格语法糖*/
11476 #define elseif else if
11477 /*aya风格语法糖*/
11478 #define _big_than_ >
11479 /*aya风格语法糖*/
11480 #define _small_than_ <
11481
11482 #if defined(_MSC_VER)
11483 #define not !
11484 #define and &&
11485 #define or ||
11486 #endif
11487
11488 /*进入名称空间,并不是很美观*/
11489 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
11490 /*退出名称空间,并不是很美观*/
11491 #define BREAK_NAMESPACE }
11492
11493 /*template说明符*/
11494 #define template_name template
11495 /*template说明符*/
11496 #define type_name class
11497
11498 #if defined(DEBUG) || defined(_DEBUG)
11499 #define not_in_debug 0
11500 #else
11501 #define not_in_debug 1
11502 #endif
11503
11504 #define es U""
11505 #define ec(ch) U ## ch
11506
11507 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
11508 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
11509 #else
11510 #define ELC_TEST_EVENTNAME(name)
11511 #endif
11512
11513 #define override_instance_struct \
11514 protected:\
11515 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
11516 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
11517 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
11518 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
11519 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
11520
11521 #if defined(_WIN32)
11522 #define distinctive __declspec(dllexport)
11523 #else
11524 #define distinctive
11525 #endif
11526
11527 #if defined(_WIN32)
11528 #define force_inline __forceinline
11529 #elif defined(__GNUC__)
11530 #define force_inline __attribute__((always_inline)) inline
11531 #else
11532 #define force_inline inline
11533 #endif
11534
11535 #if defined(_WIN32)
11536 #define with_no_vtable __declspec(novtable)
11537 #else
11538 #define with_no_vtable
11539 #endif
11540
11541 #define in_consteval (::std::is_constant_evaluated())
11542
11543 #define no_vtable_struct struct with_no_vtable
11544 #define no_vtable_class class with_no_vtable
11545
11546 //file_end
11547
11548 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
11549
11550 //file_end
11551
11552 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_body.hpp"
11553
11554 namespace exception_n{
11555 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/exception/_body.hpp"
11556 //_body.hpp
11557 //at namespace elc::defs::exception_n
11558 /*
11559 未完成的elc解释器base_exception文件
11560 由steve02081504与Alex0125设计、编写
11561 转载时请在不对此文件做任何修改的同时注明出处
11562 项目地址:https://github.com/steve02081504/ELC
11563 */
11564 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/exception/exception.hpp"
11565 //_body.hpp
11566 //at namespace elc::defs::exception_n
11567 /*
11568 未完成的elc解释器base_exception文件
11569 由steve02081504与Alex0125设计、编写
11570 转载时请在不对此文件做任何修改的同时注明出处
11571 项目地址:https://github.com/steve02081504/ELC
11572 */
11573 no_vtable_class exception{
11574 const char_t* _constexpr_str=locale::str::exception::unknow_error;
11575 public:
11576 constexpr exception()noexcept=default;
11577 constexpr exception(const constexpr_str_t<char_t>&str)noexcept:_constexpr_str(str){}
11578 virtual constexpr ~exception()noexcept=0;
11579 virtual constexpr const char_t*what()noexcept{return _constexpr_str;}
11580 };
11581 inline constexpr exception::~exception()noexcept{}
11582
11584 using exception::exception;
11585 };
11586
11587 //file_end
11588
11589 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/exception/_body.hpp"
11590
11591 //file_end
11592
11593 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_body.hpp"
11594 }
11595 namespace exceptions=exception_n;
11596
11597 #if defined(ELC_TEST_ON)
11598 namespace base_exception_part_test{
11599 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_test.hpp"
11600 //_test.hpp
11601 /*
11602 未完成的elc解释器base_exception文件
11603 由steve02081504与Alex0125设计、编写
11604 转载时请在不对此文件做任何修改的同时注明出处
11605 项目地址:https://github.com/steve02081504/ELC
11606 */
11607 inline void test(){
11608 ELC_TEST_EVENTNAME("base_exception部分测试");
11609 }
11610 inline void test_log_out(){
11611 }
11612 inline void test_end(){
11613 }
11614
11615 //file_end
11616
11617 #line 23 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_body.hpp"
11618 }
11619 #endif
11620
11621 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
11622 //_undefs.hpp
11623 /*
11624 未完成的elc解释器basic文件
11625 由steve02081504与Alex0125设计、编写
11626 转载时请在不对此文件做任何修改的同时注明出处
11627 项目地址:https://github.com/steve02081504/ELC
11628 */
11629 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
11630 //_undefs.hpp
11631 /*
11632 未完成的elc解释器_share文件
11633 由steve02081504与Alex0125设计、编写
11634 转载时请在不对此文件做任何修改的同时注明出处
11635 项目地址:https://github.com/steve02081504/ELC
11636 */
11637
11638 //defs at "_defs.hpp"
11639
11640 #if defined(_MSC_VER)
11641 #pragma warning(pop)
11642 #endif
11643 #undef suppress_msvc_warning
11644 #undef disable_msvc_warning
11645 #undef push_msvc_warning
11646 #undef pop_msvc_warning
11647 #undef push_and_disable_msvc_warning
11648
11649 //for basic_environment.hpp
11650 #undef BIT_POSSIBILITY
11651 //
11652 #if defined(ELC_VOID_NAME)
11653 #define void the_void
11654 #endif
11655
11656 // #undef often_noexcept
11657 #undef noexcept_as
11658 #undef noexcept_as_auto
11659 #undef constexpr_as
11660 #undef constexpr_as_auto
11661
11662 #undef using_method_from_base_t
11663 #undef using_method_from_value
11664
11665 #undef floop
11666 #undef enable_adl
11667
11668 #undef re_declvalue
11669 #undef re_decltype
11670
11671 #undef declvalue
11672
11673 #undef template_error
11674 #undef template_warning
11675
11676 #undef type_info_of
11677 #undef type_name_of
11678
11679 #undef is_common_attribute
11680 #undef is_special_attribute
11681
11682 #undef has_attribute
11683 #undef not_has_attribute
11684
11685 #undef float_size_of
11686 #undef bitnum_of
11687
11688 #undef def_common_attribute_with_nothing
11689 #undef def_special_attribute_with_nothing
11690
11691 #undef common_attribute_t
11692 #undef special_attribute_t
11693
11694 #undef enable_if
11695 #undef enabled_by_default
11696 #undef disabled_by_default
11697 #undef enable_if_not_ill_form
11698 #undef enable_flag
11699
11700 #undef was_an_ill_form
11701 #undef was_an_ill_form_with_parameter
11702 #undef was_not_an_ill_form
11703 #undef was_not_an_ill_form_and_noexcept
11704 #undef was_not_an_ill_form_with_parameter
11705
11706 #undef recursive_lambda
11707 #undef get_recursive_lambda_caller
11708 #undef lambda
11709 #undef lambda_with_catch
11710 #undef self_recursion
11711 #undef lambda_RLSRRS
11712
11713 #undef MAGIC
11714
11715 #undef nothing
11716
11717 #undef elseif
11718 #undef _big_than_
11719 #undef _small_than_
11720
11721 #if defined(_MSC_VER)
11722 #undef not
11723 #undef and
11724 #undef or
11725 #endif
11726
11727 #undef INTER_NAMESPACE
11728 #undef BREAK_NAMESPACE
11729
11730 #undef szie
11731 #undef form
11732
11733 #undef template_name
11734 #undef type_name
11735
11736 #undef not_in_debug
11737
11738 #undef es
11739 #undef ec
11740
11741 #undef ELC_TEST_EVENTNAME
11742
11743 #undef override_instance_struct
11744
11745 #undef distinctive
11746
11747 #undef force_inline
11748
11749 #undef with_no_vtable
11750
11751 #undef in_consteval
11752
11753 #undef no_vtable_struct
11754 #undef no_vtable_class
11755
11756 //file_end
11757
11758 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
11759
11760 //file_end
11761
11762 #line 27 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_body.hpp"
11763 }
11764 namespace elc{
11765 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_export.hpp"
11766 //_export.hpp
11767 //at namespace elc
11768 /*
11769 未完成的elc解释器base_exception文件
11770 由steve02081504与Alex0125设计、编写
11771 转载时请在不对此文件做任何修改的同时注明出处
11772 项目地址:https://github.com/steve02081504/ELC
11773 */
11774 #define export using defs::exception_n::
11775 export exception;
11776 export runtime_exception;
11777 #undef export
11778
11779 //file_end
11780
11781 #line 30 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_exception/_body.hpp"
11782 }
11783
11784 //file_end
11785
11786 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_exception"
11787 #endif
11788
11789 //file_end
11790
11791 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
11792 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_stream"
11793 //base_stream
11794 //at namespace ::
11795 /*
11796 未完成的elc解释器include文件
11797 由steve02081504与Alex0125设计、编写
11798 转载时请在不对此文件做任何修改的同时注明出处
11799 项目地址:https://github.com/steve02081504/ELC
11800 */
11801 #if !defined(ELC_BASE_STREAM)
11802 #define ELC_BASE_STREAM
11803 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/_body.hpp"
11804 //_body.hpp
11805 //at namespace ::
11806 /*
11807 未完成的elc解释器base_stream文件
11808 由steve02081504与Alex0125设计、编写
11809 转载时请在不对此文件做任何修改的同时注明出处
11810 项目地址:https://github.com/steve02081504/ELC
11811 */
11812 #if defined(ELC_TEST)
11813 #error "this part cannot be tested."
11814 #endif
11815 namespace elc::defs{
11816 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
11817 //_defs.hpp
11818 /*
11819 未完成的elc解释器basic文件
11820 由steve02081504与Alex0125设计、编写
11821 转载时请在不对此文件做任何修改的同时注明出处
11822 项目地址:https://github.com/steve02081504/ELC
11823 */
11824 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
11825 //_defs.hpp
11826 /*
11827 未完成的elc解释器_share文件
11828 由steve02081504与Alex0125设计、编写
11829 转载时请在不对此文件做任何修改的同时注明出处
11830 项目地址:https://github.com/steve02081504/ELC
11831 */
11832
11833 //undefs at "_undefs.hpp"
11834
11835 //set ELC_WARNING_LEVEL default to 4(max)
11836 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
11837
11838 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
11839 //basic_environment.hpp
11840 /*
11841 未完成的elc解释器_share文件
11842 由steve02081504与Alex0125设计、编写
11843 转载时请在不对此文件做任何修改的同时注明出处
11844 项目地址:https://github.com/steve02081504/ELC
11845 */
11846
11847 //每个bit(不是字节)的可能性
11848 //为什么c艹委员会不定义这个?
11849 #define BIT_POSSIBILITY 2
11850
11851 //file_end
11852
11853 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
11854
11855 #if defined(_MSC_VER)
11856 #pragma warning(push,ELC_WARNING_LEVEL)
11857 #pragma warning(disable:4099)//class与struct混用警告diss
11858 #pragma warning(disable:26812)//enum class安利diss.
11859 #pragma warning(disable:4584)//重复子类警告diss
11860 #pragma warning(disable:4250)//域控制继承警告diss
11861 #pragma warning(disable:26432)//不完全默认方法警告diss
11862 #pragma warning(disable:26435)//virtual override方法警告diss
11863 #pragma warning(disable:26481)//容器安利diss
11864 #pragma warning(disable:26446)//gsl::at安利diss
11865 #pragma warning(disable:26434)//方法覆盖警告diss
11866 #pragma warning(disable:26429)//gsl::not_null安利diss
11867 #pragma warning(disable:26471)//对void*进行static_cast安利diss
11868 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
11869 #pragma warning(disable:26473)//相同指针显式cast警告diss
11870 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
11871 #pragma warning(disable:26485)//数组作指针警告diss
11872 #pragma warning(disable:26490)//reinterpret_cast警告diss
11873 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
11874 #pragma warning(disable:26482)//非常数数组索引警告diss
11875 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
11876 #endif
11877 #if defined(_MSC_VER)
11878 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
11879 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
11880 #define push_msvc_warning() __pragma(warning(push))
11881 #define pop_msvc_warning() __pragma(warning(pop))
11882 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
11883 #else
11884 #define suppress_msvc_warning(...)
11885 #define disable_msvc_warning(...)
11886 #define push_msvc_warning()
11887 #define pop_msvc_warning()
11888 #define push_and_disable_msvc_warning(...)
11889 #endif
11890 //
11891 #if defined(ELC_VOID_NAME)
11892 #undef void
11893 #endif
11894
11895 // #define often_noexcept
11896 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
11897 #define noexcept_as_auto MAGIC//哦现在有了
11898 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
11899 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
11900
11901 #define using_method_from_base_t(name,...) \
11902 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
11903 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
11904 {\
11905 return base_t::name(forward<Args>(rest)...);\
11906 }\
11907
11908 #define using_method_from_value(name,value_name,...) \
11909 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
11910 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
11911 {\
11912 return value_name.name(forward<Args>(rest)...);\
11913 }\
11914
11915 #define floop while(__builtin_is_my_dick_still_there())
11916 #define enable_adl(name) void name()noexcept=delete
11917
11918 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
11919 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
11920
11921 #define declvalue(...) (::std::declval<__VA_ARGS__>())
11922
11923 /*实例化到此将引发错误*/
11924 #define template_error(reason) static_assert(template_error_helper<T>,reason)
11925 /*实例化到此将引发警告*/
11926 #define template_warning(reason) template_warning_helper<T>(reason)
11927
11928 //for type_info
11929 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
11930 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
11931
11932 #define is_common_attribute(name) public attribute<T,name<T>>
11933 #define is_special_attribute(name) public attribute<T,name>
11934
11935 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
11936 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
11937
11938 //for float_size_t
11939 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
11940 //bitnum_of
11941 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
11942
11943 //for attribute
11944 #define def_common_attribute_with_nothing(name) \
11945 template<typename T>\
11946 class name{}\
11947
11948 #define def_special_attribute_with_nothing(name) \
11949 class name{}\
11950
11951 #define common_attribute_t template<class>class
11952 #define special_attribute_t class
11953
11954 /*
11955 若参数的布尔值为零,那么此模板不会实例化
11956
11957 为什么不用cpp20的constraints?
11958 1.不能类内定义
11959 2.不能作为模板参数
11960 一句话总结:c艹标准会sb
11961 */
11962 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
11963 /*默认参与模板候选*/
11964 #define enabled_by_default class enable_state=void
11965 /*默认不参与模板候选*/
11966 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
11967 /*若参数为病式,那么此模板不会实例化*/
11968 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
11969 /*用于模板声明*/
11970 #define enable_flag class enable_state
11971
11972 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
11973 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
11974 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
11975 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
11976 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
11977
11978 /*让lambda递归更加美观*/
11979 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
11980 /*让lambda递归更加美观*/
11981 #define get_recursive_lambda_caller(name) \
11982 lambda_with_catch(&)(auto&&...Args){\
11983 return name(name,Args...);\
11984 }
11985 /*让lambda定义更加美观*/
11986 #define lambda []
11987 /*让lambda定义更加美观*/
11988 #define lambda_with_catch(...) [__VA_ARGS__]
11989 /*让lambda递归更加美观*/
11990 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
11991 //recursive_lambda_self_referential_reserved_symbolname
11992 #define lambda_RLSRRS _my_jb_super_sb_name_
11993
11994 #define MAGIC//ahh,ko no tenno da!
11995
11996 /*装饰性语法糖*/
11997 #define nothing
11998
11999 /*aya风格语法糖*/
12000 #define elseif else if
12001 /*aya风格语法糖*/
12002 #define _big_than_ >
12003 /*aya风格语法糖*/
12004 #define _small_than_ <
12005
12006 #if defined(_MSC_VER)
12007 #define not !
12008 #define and &&
12009 #define or ||
12010 #endif
12011
12012 /*进入名称空间,并不是很美观*/
12013 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
12014 /*退出名称空间,并不是很美观*/
12015 #define BREAK_NAMESPACE }
12016
12017 /*template说明符*/
12018 #define template_name template
12019 /*template说明符*/
12020 #define type_name class
12021
12022 #if defined(DEBUG) || defined(_DEBUG)
12023 #define not_in_debug 0
12024 #else
12025 #define not_in_debug 1
12026 #endif
12027
12028 #define es U""
12029 #define ec(ch) U ## ch
12030
12031 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
12032 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
12033 #else
12034 #define ELC_TEST_EVENTNAME(name)
12035 #endif
12036
12037 #define override_instance_struct \
12038 protected:\
12039 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
12040 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
12041 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
12042 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
12043 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
12044
12045 #if defined(_WIN32)
12046 #define distinctive __declspec(dllexport)
12047 #else
12048 #define distinctive
12049 #endif
12050
12051 #if defined(_WIN32)
12052 #define force_inline __forceinline
12053 #elif defined(__GNUC__)
12054 #define force_inline __attribute__((always_inline)) inline
12055 #else
12056 #define force_inline inline
12057 #endif
12058
12059 #if defined(_WIN32)
12060 #define with_no_vtable __declspec(novtable)
12061 #else
12062 #define with_no_vtable
12063 #endif
12064
12065 #define in_consteval (::std::is_constant_evaluated())
12066
12067 #define no_vtable_struct struct with_no_vtable
12068 #define no_vtable_class class with_no_vtable
12069
12070 //file_end
12071
12072 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
12073
12074 //file_end
12075
12076 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/_body.hpp"
12077
12078 namespace stream_n{
12079 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/base_streams/_body.hpp"
12080 //_body.hpp
12081 //at namespace elc
12082 /*
12083 未完成的elc解释器base_stream文件
12084 由steve02081504与Alex0125设计、编写
12085 转载时请在不对此文件做任何修改的同时注明出处
12086 项目地址:https://github.com/steve02081504/ELC
12087 */
12088 push_and_disable_msvc_warning(4250);
12089 enum seek_type{beg,end,cur};
12090 no_vtable_struct base_stream{
12091 virtual ~base_stream()=default;
12092 virtual void*seek(seek_type,int_t)=0;
12093 virtual void*tell(){return this->seek(cur,0);}
12094 virtual void seek_to(void*)=0;
12095 virtual void sync()=0;
12096 virtual void flush()=0;
12097 virtual void close()=0;
12098 };
12099 no_vtable_struct base_ostream:virtual base_stream{
12100 virtual ~base_ostream()=default;
12101 virtual void write(const byte*buf,size_t size)=0;
12102 template<class T>
12103 void write(const T*v,size_t size=1){
12104 this->write(cast_to_data(v),size*sizeof(T));
12105 }
12106 };
12107 no_vtable_struct base_istream:virtual base_stream{
12108 virtual ~base_istream()=default;
12109 virtual size_t read(byte*buf,size_t size)=0;
12110 template<class T>
12111 size_t read(T*v,size_t size=1){
12112 return this->read(cast_to_data(v),size*sizeof(T))/sizeof(T);
12113 }
12114 };
12115 no_vtable_struct base_iostream:virtual base_istream,virtual base_ostream{};
12116
12117
12118 no_vtable_struct noexcept_stream:virtual base_stream{
12119 virtual ~noexcept_stream()noexcept override=default;
12120 virtual void*seek(seek_type,int_t)noexcept override=0;
12121 virtual void*tell()noexcept override{return this->seek(cur,0);}
12122 virtual void seek_to(void*)noexcept override=0;
12123 virtual void sync()noexcept override=0;
12124 virtual void flush()noexcept override=0;
12125 virtual void close()noexcept override=0;
12126 };
12127 no_vtable_struct noexcept_ostream:virtual base_ostream,virtual noexcept_stream{
12128 virtual void write(const byte*buf,size_t size)noexcept override=0;
12129 template<class T>
12130 void write(const T*v,size_t size=1)noexcept{
12131 this->write(cast_to_data(v),size*sizeof(T));
12132 }
12133 };
12134 no_vtable_struct noexcept_istream:virtual base_istream,virtual noexcept_stream{
12135 virtual size_t read(byte*buf,size_t size)noexcept override=0;
12136 template<class T>
12137 size_t read(T*v,size_t size=1)noexcept{
12138 return this->read(cast_to_data(v),size*sizeof(T))/sizeof(T);
12139 }
12140 };
12141 no_vtable_struct noexcept_iostream:virtual base_iostream,virtual noexcept_ostream,virtual noexcept_istream{};
12142 static_assert(noexcept(((noexcept_iostream*)(nullptr))->~noexcept_iostream()));
12143 static_assert(noexcept(((noexcept_iostream*)(nullptr))->sync()));
12144
12145 //string streams
12146 no_vtable_struct string_istream: virtual base_istream{};
12147 no_vtable_struct string_ostream: virtual base_ostream{};
12148 no_vtable_struct string_iostream: virtual string_istream,virtual string_ostream,virtual base_iostream{};
12149 //noexcept_
12150 no_vtable_struct noexcept_string_istream: virtual noexcept_istream,virtual string_istream{};
12151 no_vtable_struct noexcept_string_ostream: virtual noexcept_ostream,virtual string_ostream{};
12153
12154
12155 //data streams
12156 no_vtable_struct data_istream: virtual base_istream{};
12157 no_vtable_struct data_ostream: virtual base_ostream{};
12158 no_vtable_struct data_iostream: virtual data_istream,virtual data_ostream,virtual base_iostream{};
12159 //noexcept_
12160 no_vtable_struct noexcept_data_istream: virtual noexcept_istream,virtual data_istream{};
12161 no_vtable_struct noexcept_data_ostream: virtual noexcept_ostream,virtual data_ostream{};
12163
12164 pop_msvc_warning();
12165
12166 //file_end
12167
12168 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/_body.hpp"
12169 }
12170 using namespace stream_n;
12171
12172 #if defined(ELC_TEST_ON)
12173 namespace base_stream_part_test{
12174 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/_test.hpp"
12175 //_test.hpp
12176 /*
12177 未完成的elc解释器base_stream文件
12178 由steve02081504与Alex0125设计、编写
12179 转载时请在不对此文件做任何修改的同时注明出处
12180 项目地址:https://github.com/steve02081504/ELC
12181 */
12182 inline void test(){
12183 ELC_TEST_EVENTNAME("base_stream部分测试");
12184 }
12185 inline void test_log_out(){
12186 }
12187 inline void test_end(){
12188 }
12189
12190 //file_end
12191
12192 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/_body.hpp"
12193 }
12194 #endif
12195
12196 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
12197 //_undefs.hpp
12198 /*
12199 未完成的elc解释器basic文件
12200 由steve02081504与Alex0125设计、编写
12201 转载时请在不对此文件做任何修改的同时注明出处
12202 项目地址:https://github.com/steve02081504/ELC
12203 */
12204 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
12205 //_undefs.hpp
12206 /*
12207 未完成的elc解释器_share文件
12208 由steve02081504与Alex0125设计、编写
12209 转载时请在不对此文件做任何修改的同时注明出处
12210 项目地址:https://github.com/steve02081504/ELC
12211 */
12212
12213 //defs at "_defs.hpp"
12214
12215 #if defined(_MSC_VER)
12216 #pragma warning(pop)
12217 #endif
12218 #undef suppress_msvc_warning
12219 #undef disable_msvc_warning
12220 #undef push_msvc_warning
12221 #undef pop_msvc_warning
12222 #undef push_and_disable_msvc_warning
12223
12224 //for basic_environment.hpp
12225 #undef BIT_POSSIBILITY
12226 //
12227 #if defined(ELC_VOID_NAME)
12228 #define void the_void
12229 #endif
12230
12231 // #undef often_noexcept
12232 #undef noexcept_as
12233 #undef noexcept_as_auto
12234 #undef constexpr_as
12235 #undef constexpr_as_auto
12236
12237 #undef using_method_from_base_t
12238 #undef using_method_from_value
12239
12240 #undef floop
12241 #undef enable_adl
12242
12243 #undef re_declvalue
12244 #undef re_decltype
12245
12246 #undef declvalue
12247
12248 #undef template_error
12249 #undef template_warning
12250
12251 #undef type_info_of
12252 #undef type_name_of
12253
12254 #undef is_common_attribute
12255 #undef is_special_attribute
12256
12257 #undef has_attribute
12258 #undef not_has_attribute
12259
12260 #undef float_size_of
12261 #undef bitnum_of
12262
12263 #undef def_common_attribute_with_nothing
12264 #undef def_special_attribute_with_nothing
12265
12266 #undef common_attribute_t
12267 #undef special_attribute_t
12268
12269 #undef enable_if
12270 #undef enabled_by_default
12271 #undef disabled_by_default
12272 #undef enable_if_not_ill_form
12273 #undef enable_flag
12274
12275 #undef was_an_ill_form
12276 #undef was_an_ill_form_with_parameter
12277 #undef was_not_an_ill_form
12278 #undef was_not_an_ill_form_and_noexcept
12279 #undef was_not_an_ill_form_with_parameter
12280
12281 #undef recursive_lambda
12282 #undef get_recursive_lambda_caller
12283 #undef lambda
12284 #undef lambda_with_catch
12285 #undef self_recursion
12286 #undef lambda_RLSRRS
12287
12288 #undef MAGIC
12289
12290 #undef nothing
12291
12292 #undef elseif
12293 #undef _big_than_
12294 #undef _small_than_
12295
12296 #if defined(_MSC_VER)
12297 #undef not
12298 #undef and
12299 #undef or
12300 #endif
12301
12302 #undef INTER_NAMESPACE
12303 #undef BREAK_NAMESPACE
12304
12305 #undef szie
12306 #undef form
12307
12308 #undef template_name
12309 #undef type_name
12310
12311 #undef not_in_debug
12312
12313 #undef es
12314 #undef ec
12315
12316 #undef ELC_TEST_EVENTNAME
12317
12318 #undef override_instance_struct
12319
12320 #undef distinctive
12321
12322 #undef force_inline
12323
12324 #undef with_no_vtable
12325
12326 #undef in_consteval
12327
12328 #undef no_vtable_struct
12329 #undef no_vtable_class
12330
12331 //file_end
12332
12333 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
12334
12335 //file_end
12336
12337 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/_body.hpp"
12338 }
12339 namespace elc{
12340 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/_export.hpp"
12341 //_export.hpp
12342 //at namespace elc
12343 /*
12344 未完成的elc解释器base_stream文件
12345 由steve02081504与Alex0125设计、编写
12346 转载时请在不对此文件做任何修改的同时注明出处
12347 项目地址:https://github.com/steve02081504/ELC
12348 */
12349 #define export using defs::
12350 export base_stream;
12351 export base_ostream;
12352 export base_istream;
12353 export base_iostream;
12354 export noexcept_stream;
12355 export noexcept_ostream;
12356 export noexcept_istream;
12357 export noexcept_iostream;
12358 #undef export
12359
12360 //file_end
12361
12362 #line 29 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/base_stream/_body.hpp"
12363 }
12364
12365 //file_end
12366
12367 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_stream"
12368 #endif
12369
12370 //file_end
12371
12372 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
12373 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
12374 //core
12375 //at namespace ::
12376 /*
12377 未完成的elc解释器include文件
12378 由steve02081504与Alex0125设计、编写
12379 转载时请在不对此文件做任何修改的同时注明出处
12380 项目地址:https://github.com/steve02081504/ELC
12381 */
12382 #if !defined(ELC_CORE)
12383 #define ELC_CORE
12384 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
12385 //base
12386 //at namespace ::
12387 /*
12388 未完成的elc解释器include文件
12389 由steve02081504与Alex0125设计、编写
12390 转载时请在不对此文件做任何修改的同时注明出处
12391 项目地址:https://github.com/steve02081504/ELC
12392 */
12393 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
12394
12395 //file_end
12396
12397 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
12398 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_exception"
12399 //base_exception
12400 //at namespace ::
12401 /*
12402 未完成的elc解释器include文件
12403 由steve02081504与Alex0125设计、编写
12404 转载时请在不对此文件做任何修改的同时注明出处
12405 项目地址:https://github.com/steve02081504/ELC
12406 */
12407 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_exception"
12408
12409 //file_end
12410
12411 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
12412 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_stream"
12413 //base_stream
12414 //at namespace ::
12415 /*
12416 未完成的elc解释器include文件
12417 由steve02081504与Alex0125设计、编写
12418 转载时请在不对此文件做任何修改的同时注明出处
12419 项目地址:https://github.com/steve02081504/ELC
12420 */
12421 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_stream"
12422
12423 //file_end
12424
12425 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
12426 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
12427 //_body.hpp
12428 //at namespace ::
12429 /*
12430 未完成的elc解释器core文件
12431 由steve02081504与Alex0125设计、编写
12432 转载时请在不对此文件做任何修改的同时注明出处
12433 项目地址:https://github.com/steve02081504/ELC
12434 */
12435 #if defined(ELC_TEST)
12436 #error "this part cannot be tested."
12437 #endif
12438 namespace elc::defs{
12439 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
12440 //_defs.hpp
12441 /*
12442 未完成的elc解释器basic文件
12443 由steve02081504与Alex0125设计、编写
12444 转载时请在不对此文件做任何修改的同时注明出处
12445 项目地址:https://github.com/steve02081504/ELC
12446 */
12447 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
12448 //_defs.hpp
12449 /*
12450 未完成的elc解释器_share文件
12451 由steve02081504与Alex0125设计、编写
12452 转载时请在不对此文件做任何修改的同时注明出处
12453 项目地址:https://github.com/steve02081504/ELC
12454 */
12455
12456 //undefs at "_undefs.hpp"
12457
12458 //set ELC_WARNING_LEVEL default to 4(max)
12459 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
12460
12461 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
12462 //basic_environment.hpp
12463 /*
12464 未完成的elc解释器_share文件
12465 由steve02081504与Alex0125设计、编写
12466 转载时请在不对此文件做任何修改的同时注明出处
12467 项目地址:https://github.com/steve02081504/ELC
12468 */
12469
12470 //每个bit(不是字节)的可能性
12471 //为什么c艹委员会不定义这个?
12472 #define BIT_POSSIBILITY 2
12473
12474 //file_end
12475
12476 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
12477
12478 #if defined(_MSC_VER)
12479 #pragma warning(push,ELC_WARNING_LEVEL)
12480 #pragma warning(disable:4099)//class与struct混用警告diss
12481 #pragma warning(disable:26812)//enum class安利diss.
12482 #pragma warning(disable:4584)//重复子类警告diss
12483 #pragma warning(disable:4250)//域控制继承警告diss
12484 #pragma warning(disable:26432)//不完全默认方法警告diss
12485 #pragma warning(disable:26435)//virtual override方法警告diss
12486 #pragma warning(disable:26481)//容器安利diss
12487 #pragma warning(disable:26446)//gsl::at安利diss
12488 #pragma warning(disable:26434)//方法覆盖警告diss
12489 #pragma warning(disable:26429)//gsl::not_null安利diss
12490 #pragma warning(disable:26471)//对void*进行static_cast安利diss
12491 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
12492 #pragma warning(disable:26473)//相同指针显式cast警告diss
12493 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
12494 #pragma warning(disable:26485)//数组作指针警告diss
12495 #pragma warning(disable:26490)//reinterpret_cast警告diss
12496 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
12497 #pragma warning(disable:26482)//非常数数组索引警告diss
12498 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
12499 #endif
12500 #if defined(_MSC_VER)
12501 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
12502 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
12503 #define push_msvc_warning() __pragma(warning(push))
12504 #define pop_msvc_warning() __pragma(warning(pop))
12505 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
12506 #else
12507 #define suppress_msvc_warning(...)
12508 #define disable_msvc_warning(...)
12509 #define push_msvc_warning()
12510 #define pop_msvc_warning()
12511 #define push_and_disable_msvc_warning(...)
12512 #endif
12513 //
12514 #if defined(ELC_VOID_NAME)
12515 #undef void
12516 #endif
12517
12518 // #define often_noexcept
12519 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
12520 #define noexcept_as_auto MAGIC//哦现在有了
12521 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
12522 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
12523
12524 #define using_method_from_base_t(name,...) \
12525 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
12526 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
12527 {\
12528 return base_t::name(forward<Args>(rest)...);\
12529 }\
12530
12531 #define using_method_from_value(name,value_name,...) \
12532 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
12533 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
12534 {\
12535 return value_name.name(forward<Args>(rest)...);\
12536 }\
12537
12538 #define floop while(__builtin_is_my_dick_still_there())
12539 #define enable_adl(name) void name()noexcept=delete
12540
12541 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
12542 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
12543
12544 #define declvalue(...) (::std::declval<__VA_ARGS__>())
12545
12546 /*实例化到此将引发错误*/
12547 #define template_error(reason) static_assert(template_error_helper<T>,reason)
12548 /*实例化到此将引发警告*/
12549 #define template_warning(reason) template_warning_helper<T>(reason)
12550
12551 //for type_info
12552 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
12553 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
12554
12555 #define is_common_attribute(name) public attribute<T,name<T>>
12556 #define is_special_attribute(name) public attribute<T,name>
12557
12558 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
12559 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
12560
12561 //for float_size_t
12562 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
12563 //bitnum_of
12564 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
12565
12566 //for attribute
12567 #define def_common_attribute_with_nothing(name) \
12568 template<typename T>\
12569 class name{}\
12570
12571 #define def_special_attribute_with_nothing(name) \
12572 class name{}\
12573
12574 #define common_attribute_t template<class>class
12575 #define special_attribute_t class
12576
12577 /*
12578 若参数的布尔值为零,那么此模板不会实例化
12579
12580 为什么不用cpp20的constraints?
12581 1.不能类内定义
12582 2.不能作为模板参数
12583 一句话总结:c艹标准会sb
12584 */
12585 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
12586 /*默认参与模板候选*/
12587 #define enabled_by_default class enable_state=void
12588 /*默认不参与模板候选*/
12589 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
12590 /*若参数为病式,那么此模板不会实例化*/
12591 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
12592 /*用于模板声明*/
12593 #define enable_flag class enable_state
12594
12595 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
12596 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
12597 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
12598 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
12599 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
12600
12601 /*让lambda递归更加美观*/
12602 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
12603 /*让lambda递归更加美观*/
12604 #define get_recursive_lambda_caller(name) \
12605 lambda_with_catch(&)(auto&&...Args){\
12606 return name(name,Args...);\
12607 }
12608 /*让lambda定义更加美观*/
12609 #define lambda []
12610 /*让lambda定义更加美观*/
12611 #define lambda_with_catch(...) [__VA_ARGS__]
12612 /*让lambda递归更加美观*/
12613 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
12614 //recursive_lambda_self_referential_reserved_symbolname
12615 #define lambda_RLSRRS _my_jb_super_sb_name_
12616
12617 #define MAGIC//ahh,ko no tenno da!
12618
12619 /*装饰性语法糖*/
12620 #define nothing
12621
12622 /*aya风格语法糖*/
12623 #define elseif else if
12624 /*aya风格语法糖*/
12625 #define _big_than_ >
12626 /*aya风格语法糖*/
12627 #define _small_than_ <
12628
12629 #if defined(_MSC_VER)
12630 #define not !
12631 #define and &&
12632 #define or ||
12633 #endif
12634
12635 /*进入名称空间,并不是很美观*/
12636 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
12637 /*退出名称空间,并不是很美观*/
12638 #define BREAK_NAMESPACE }
12639
12640 /*template说明符*/
12641 #define template_name template
12642 /*template说明符*/
12643 #define type_name class
12644
12645 #if defined(DEBUG) || defined(_DEBUG)
12646 #define not_in_debug 0
12647 #else
12648 #define not_in_debug 1
12649 #endif
12650
12651 #define es U""
12652 #define ec(ch) U ## ch
12653
12654 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
12655 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
12656 #else
12657 #define ELC_TEST_EVENTNAME(name)
12658 #endif
12659
12660 #define override_instance_struct \
12661 protected:\
12662 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
12663 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
12664 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
12665 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
12666 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
12667
12668 #if defined(_WIN32)
12669 #define distinctive __declspec(dllexport)
12670 #else
12671 #define distinctive
12672 #endif
12673
12674 #if defined(_WIN32)
12675 #define force_inline __forceinline
12676 #elif defined(__GNUC__)
12677 #define force_inline __attribute__((always_inline)) inline
12678 #else
12679 #define force_inline inline
12680 #endif
12681
12682 #if defined(_WIN32)
12683 #define with_no_vtable __declspec(novtable)
12684 #else
12685 #define with_no_vtable
12686 #endif
12687
12688 #define in_consteval (::std::is_constant_evaluated())
12689
12690 #define no_vtable_struct struct with_no_vtable
12691 #define no_vtable_class class with_no_vtable
12692
12693 //file_end
12694
12695 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
12696
12697 //file_end
12698
12699 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
12700
12701 namespace core{
12702 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/_body.hpp"
12703 //_body.hpp
12704 //at namespace elc::defs::core
12705 /*
12706 未完成的elc解释器base文件
12707 由steve02081504与Alex0125设计、编写
12708 转载时请在不对此文件做任何修改的同时注明出处
12709 项目地址:https://github.com/steve02081504/ELC
12710 */
12711 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/decl.hpp"
12712 //decl.hpp
12713 //at namespace elc::defs::core
12714 /*
12715 未完成的elc解释器core文件
12716 由steve02081504与Alex0125设计、编写
12717 转载时请在不对此文件做任何修改的同时注明出处
12718 项目地址:https://github.com/steve02081504/ELC
12719 */
12720 struct node_like;
12721 typedef comn_ptr_t<node_like>ptr;
12722 typedef weak_ptr_t<node_like>weak_ptr;
12723 typedef comn_ptr_t<const node_like>const_ptr;
12724 typedef weak_ptr_t<const node_like>const_weak_ptr;
12725 struct value;
12726
12727 BREAK_NAMESPACE
12728 namespace string_n{
12729 template<typename char_T>
12730 struct string_t;
12731 typedef string_t<char_t> string;
12732 }
12733 using string_n::string_t;
12734 using string_n::string;
12735 template<constexpr_str_n::constexpr_str_t_literal_helper str_helper>
12736 inline constexpr string operator""_elc_string()noexcept;
12737 INTER_NAMESPACE(core)
12738
12739 template<typename T>
12740 [[nodiscard]]inline ptr make_long_term_binary_node_from(T a)noexcept;
12741
12742 template<typename T>
12743 constexpr bool as_ptr_nothrow_helper()noexcept{
12744 if constexpr(was_not_an_ill_form(ptr(&declvalue(T))))
12745 return noexcept(ptr(&declvalue(T)));
12746 elseif constexpr(was_not_an_ill_form(const_ptr(&declvalue(T))))
12747 return noexcept(const_ptr(&declvalue(T)));
12748 elseif constexpr(was_not_an_ill_form(static_cast<node_like&>(declvalue(T))))
12749 return noexcept(&static_cast<node_like&>(declvalue(T)));
12750 elseif constexpr(was_not_an_ill_form(static_cast<const node_like&>(declvalue(T))))
12751 return noexcept(&static_cast<const node_like&>(declvalue(T)));
12752 elseif constexpr(was_not_an_ill_form(static_cast<value&>(declvalue(T))))
12753 return noexcept(ptr(static_cast<value&>(declvalue(T))));
12754 elseif constexpr(was_not_an_ill_form(static_cast<const value&>(declvalue(T))))
12755 return noexcept(const_ptr(static_cast<value&>(declvalue(T))));
12756 elseif constexpr(was_not_an_ill_form(ptr(declvalue(T))))
12757 return noexcept(ptr(declvalue(T)));
12758 elseif constexpr(was_not_an_ill_form(const_ptr(declvalue(T))))
12759 return noexcept(const_ptr(declvalue(T)));
12760 elseif constexpr(type_info<remove_cvref<T>> == type_info<char_t>)
12761 return noexcept(make_long_term_binary_node_from<char_t>(declvalue(T)));
12762 elseif constexpr(::std::is_integral_v<remove_cvref<T>>){
12763 if constexpr(::std::is_signed_v<remove_cvref<T>>)
12764 return noexcept(make_long_term_binary_node_from<int_t>(declvalue(T)));
12765 else
12766 return noexcept(make_long_term_binary_node_from<uint_t>(declvalue(T)));
12767 }
12768 elseif constexpr(::std::is_floating_point_v<remove_cvref<T>>)
12769 return noexcept(make_long_term_binary_node_from<float_t>(declvalue(T)));
12770 elseif constexpr(construct<string>.able<T>){
12771 return noexcept(make_long_term_binary_node_from<string>(declvalue(T)));
12772 }
12773 }
12774 template<typename T>
12775 decltype(auto) as_ptr(T&&a)noexcept(as_ptr_nothrow_helper<T>()){
12776 ELC_TEST_EVENTNAME("as_ptr转换");
12777 if constexpr(was_not_an_ill_form(ptr(&a)))
12778 return ptr(&a);
12779 elseif constexpr(was_not_an_ill_form(const_ptr(&a)))
12780 return const_ptr(&a);
12781 elseif constexpr(was_not_an_ill_form(static_cast<node_like&>(a)))
12782 return &static_cast<node_like&>(a);
12783 elseif constexpr(was_not_an_ill_form(static_cast<const node_like&>(a)))
12784 return &static_cast<const node_like&>(a);
12785 elseif constexpr(was_not_an_ill_form(static_cast<value&>(a)))
12786 return ptr(static_cast<value&>(a));
12787 elseif constexpr(was_not_an_ill_form(static_cast<const value&>(a)))
12788 return const_ptr(static_cast<value&>(a));
12789 elseif constexpr(was_not_an_ill_form(ptr(a)))
12790 return ptr(a);
12791 elseif constexpr(was_not_an_ill_form(const_ptr(a)))
12792 return const_ptr(a);
12793 elseif constexpr(type_info<remove_cvref<T>> == type_info<char_t>)
12794 return make_long_term_binary_node_from<char_t>(a);
12795 elseif constexpr(::std::is_integral_v<remove_cvref<T>>){
12796 if constexpr(::std::is_signed_v<remove_cvref<T>>)
12797 return make_long_term_binary_node_from<int_t>(a);
12798 else
12799 return make_long_term_binary_node_from<uint_t>(a);
12800 }
12801 elseif constexpr(::std::is_floating_point_v<remove_cvref<T>>)
12802 return make_long_term_binary_node_from<float_t>(a);
12803 elseif constexpr(construct<string>.able<T>){
12804 return make_long_term_binary_node_from<string>(a);
12805 }
12806 }
12807
12808 template<typename T>
12809 constexpr bool as_value_nothrow_helper()noexcept{
12810 if constexpr(was_not_an_ill_form(static_cast<value&>(declvalue(T))))
12811 return noexcept(static_cast<value&>(declvalue(T)));
12812 elseif constexpr(was_not_an_ill_form(static_cast<const value&>(declvalue(T))))
12813 return noexcept(static_cast<const value&>(declvalue(T)));
12814 elseif constexpr(was_not_an_ill_form(as_ptr(declvalue(T)))){
12815 if constexpr(type_info<decltype(as_ptr(declvalue(T)))> == type_info<ptr>)
12816 return noexcept(value(as_ptr(declvalue(T))));
12817 elseif constexpr(type_info<decltype(as_ptr(declvalue(T)))> == type_info<const_ptr>)
12818 return noexcept((const value)remove_const((const node_like*)as_ptr(declvalue(T))));
12819 }
12820 }
12821 template<typename T>
12822 decltype(auto) as_value(T&& a)noexcept(as_value_nothrow_helper<T>()){
12823 ELC_TEST_EVENTNAME("as_value转换");
12824 if constexpr(was_not_an_ill_form(static_cast<value&>(a)))
12825 return static_cast<value&>(a);
12826 elseif constexpr(was_not_an_ill_form(static_cast<const value&>(a)))
12827 return static_cast<const value&>(a);
12828 elseif constexpr(was_not_an_ill_form(as_ptr(declvalue(T)))){
12829 if constexpr(type_info<decltype(as_ptr(declvalue(T)))> == type_info<ptr>)
12830 return value(as_ptr(forward<T>(a)));
12831 elseif constexpr(type_info<decltype(as_ptr(declvalue(T)))> == type_info<const_ptr>)
12832 return (const value)remove_const((const node_like*)as_ptr(forward<T>(a)));
12833 }
12834 }
12835
12836 //file_end
12837
12838 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/_body.hpp"
12839
12840 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/node_like.hpp"
12841 //defs.hpp
12842 //at namespace elc::defs::core
12843 /*
12844 未完成的elc解释器core文件
12845 由steve02081504与Alex0125设计、编写
12846 转载时请在不对此文件做任何修改的同时注明出处
12847 项目地址:https://github.com/steve02081504/ELC
12848 */
12849 [[nodiscard]]inline ptr make_list()noexcept;
12850 template<typename T,typename...Args>
12851 [[nodiscard]]inline ptr make_list(T&&first,Args&&...rest);
12852
12853 no_vtable_struct node_like:type_info_t<node_like>::template_name
12854 with_common_attribute<abstract_base,weak_ref_able,replace_able,ref_able>{
12855 public:
12856 typedef node_like this_t;
12857
12858 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept=0;
12859
12860 [[nodiscard]]virtual value be_eval();
12861 [[nodiscard]]virtual value be_call(ptr);
12862 protected:
12863 [[nodiscard]]virtual logical_bool equal_with(const_ptr)const noexcept=0;
12864 [[nodiscard]]virtual logical_bool eq_with(const_ptr a)const noexcept{return a.get()==this;}//不是a==this:ptr的opertaor==将调用在下方定义的pointer_equal,这会通过eq间接调用eq_with
12865 [[nodiscard]]virtual constexpr size_t equal_level()const noexcept{return 36;}
12866 [[nodiscard]]virtual constexpr size_t eq_level()const noexcept{return 36;}
12867 public:
12868 node_like()noexcept=default;
12869 node_like(never_ref_num_zero_t)noexcept{ attribute_ptr_cast<ref_able>(this)->init_never_ref_num_zero(); }
12870 virtual ~node_like()=default;
12871
12872 [[nodiscard]]virtual value arec(const value)=0;
12873
12874 [[nodiscard]]value operator[](const value index);
12875 [[nodiscard]]value operator[](auto&&index){
12876 return operator[](as_value(index));
12877 }
12878
12879 virtual void clear()noexcept=0;
12880
12881 [[nodiscard]]virtual explicit operator hash_t()const noexcept{return hash((void*)this);}
12882 void destroy()noexcept{
12883 this->be_replace_as(null_ptr);
12884 }
12885 virtual void be_replace_as(ptr a)noexcept{
12886 this->clear();
12888 }
12889
12890 [[nodiscard]]virtual explicit operator logical_bool()const noexcept{return true;}
12891 [[nodiscard]]explicit operator bool()const noexcept{return(bool)this->operator logical_bool();}
12892
12893 template<typename...Args>
12894 inline value operator()(Args&&...rest){return this->be_call(make_list(forward<Args>(rest)...));}
12895
12896 [[nodiscard]]logical_bool eq(const_ptr a)const noexcept{
12897 const auto this_eqlv = this->eq_level();
12898 const auto arg_eqlv = a->eq_level();
12899 if(this_eqlv _small_than_ arg_eqlv)
12900 return a->eq_with(this);
12901 elseif(this_eqlv _big_than_ arg_eqlv)
12902 return this->eq_with(a);
12903 else
12904 return this->eq_with(a)&&a->eq_with(this);
12905 }
12906 [[nodiscard]]logical_bool equal(const_ptr a)const noexcept{
12907 const auto this_equlv = this->equal_level();
12908 const auto arg_equlv = a->equal_level();
12909 if(this_equlv _small_than_ arg_equlv)
12910 return a->equal_with(this);
12911 elseif(this_equlv _big_than_ arg_equlv)
12912 return this->equal_with(a);
12913 else
12914 return this->equal_with(a)&&a->equal_with(this);
12915 }
12916
12917 [[nodiscard]]ptr operator&()noexcept{return this;}
12918 [[nodiscard]]const_ptr operator&()const noexcept{return this;}
12919 [[nodiscard]]logical_bool operator==(const this_t&a)const noexcept{
12920 return a.equal(this);
12921 }
12922 protected:
12923 friend void the_waiting_for_destroy(node_like* a)noexcept;
12924 virtual void waiting_for_destroy()noexcept{clear();}
12925 };
12926
12927 //base中的类型功能适应器
12928 [[nodiscard]]inline constexpr node_like*the_get_null_ptr(const node_like*)noexcept;//{return&void;}
12929 [[nodiscard]]inline logical_bool the_pointer_to_bool(const node_like*a)noexcept{
12930 return a->operator logical_bool();
12931 }
12932 [[nodiscard]]inline logical_bool the_pointer_equal(const node_like*a,const node_like*b)noexcept{
12933 return a->eq(b);
12934 }
12935 [[nodiscard]]inline hash_t the_pointer_hash(const node_like*a)noexcept{
12936 return a->operator hash_t();
12937 }
12938 //ptr中的类型功能适应器
12939 inline void the_waiting_for_destroy(node_like*a)noexcept{
12940 a->waiting_for_destroy();
12941 }
12942 inline void the_destroy_and_free(node_like*a)noexcept{
12943 unget(a);
12944 }
12945
12946 //gc中的类型功能适应器
12947 inline void the_destroy(node_like*a)noexcept{
12948 a->destroy();
12949 }
12950
12951 //file_end
12952
12953 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/_body.hpp"
12954 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/ptr.hpp"
12955 //def.hpp
12956 //at namespace elc::defs::core
12957 /*
12958 未完成的elc解释器core文件
12959 由steve02081504与Alex0125设计、编写
12960 转载时请在不对此文件做任何修改的同时注明出处
12961 项目地址:https://github.com/steve02081504/ELC
12962 */
12963 typedef comn_ptr_t<node_like>ptr;
12964 typedef weak_ptr_t<node_like>weak_ptr;
12965 typedef comn_ptr_t<const node_like>const_ptr;
12966 typedef weak_ptr_t<const node_like>const_weak_ptr;
12967
12968 //file_end
12969
12970 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/_body.hpp"
12971 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/value.hpp"
12972 //value.hpp
12973 //at namespace elc::defs::core
12974 /*
12975 未完成的elc解释器core文件
12976 由steve02081504与Alex0125设计、编写
12977 转载时请在不对此文件做任何修改的同时注明出处
12978 项目地址:https://github.com/steve02081504/ELC
12979 */
12981 typedef value this_t;
12983 with_common_attribute<abstract_base,ref_able,never_in_array,replace_able>,
12985 /*//COMMIT:
12986 是否应当支持value data的引用计数?
12987 否的原因:
12988 这将导致应当对value的data加入gc机制(否则容易出现闭环value垃圾!)
12989 而这将严重增加elc的运行时时空负担
12990 有人可能得到递归引用的value
12991 是的原因:
12992 防御式编程
12993 更佳多样的value实现
12994 引用计数以降低value的复制开销
12995 对否定想法的驳回:
12996 严重增加elc的运行时时空负担?:value的复制开销可能更大
12997 有人可能得到递归引用的value?这将导致应当对value的data加入gc机制?:
12998 没见哪个语言不允许写while(true)
12999 自定义value的应该都是聪明人,如果真的会出现循环引用那他们自己解决就好
13000 总结:
13001 加引用计数,但不加gc
13002 elc的设计理念包括“不应禁止用户做什么”,所以应当提供高自由度的value定制可能
13003 但出于性能考虑,不加gc
13004 如果真的有需要gc解决的value data那么让那聪明的设计者自己给自己的data类加gc解决这种问题就好
13005 */
13006 base_data_t()noexcept=default;
13007 base_data_t(never_ref_num_zero_t)noexcept{ attribute_ptr_cast<ref_able>(this)->init_never_ref_num_zero(); }
13008 virtual ~base_data_t()noexcept=default;
13009
13010 virtual void be_set(ptr)=0;
13011 [[nodiscard]]virtual ptr get_value()=0;
13012 [[nodiscard]]virtual base_data_t*copy()const noexcept=0;
13013 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept=0;//为什么要加这个?我不知道,万一将来有人用上了呢?
13014 };
13015
13016 distinctive inline static struct null_data_t final:instance_struct<null_data_t>
13018 null_data_t()noexcept:value::base_data_t(never_ref_num_zero){}
13019 virtual ~null_data_t()noexcept override final=default;
13020
13021 virtual void be_set(ptr a)noexcept override final{}
13022 [[nodiscard]]virtual ptr get_value()noexcept override final{return null_ptr;}
13023 [[nodiscard]]virtual base_data_t*copy()const noexcept override final{return remove_const(this);}
13024 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override final{return type_info<null_data_t>;}
13025 }null_data{};
13026
13027 struct constexpr_data_t final:instance_struct<constexpr_data_t>
13028 ,base_data_t{
13029 ptr _m;
13030 constexpr_data_t(ptr a)noexcept:_m(a){}
13031 constexpr_data_t(const constexpr_data_t&)noexcept=default;
13032 virtual ~constexpr_data_t()noexcept override final=default;
13033
13034 virtual void be_set(ptr)noexcept override final{}
13035 [[nodiscard]]virtual ptr get_value()noexcept override final{return _m;}
13036 [[nodiscard]]virtual base_data_t*copy()const noexcept override final{return get<constexpr_data_t>(_m);}
13037 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override final{return type_info<constexpr_data_t>;}
13038 };
13039
13040 struct variable_data_t final:instance_struct<variable_data_t>
13041 ,base_data_t{
13042 ptr _m;
13043 variable_data_t(ptr a)noexcept:_m(a){}
13044 variable_data_t(const variable_data_t&)noexcept=default;
13045 virtual ~variable_data_t()noexcept override final=default;
13046
13047 virtual void be_set(ptr a)noexcept override final{_m=a;}
13048 [[nodiscard]]virtual ptr get_value()noexcept override final{return _m;}
13049 [[nodiscard]]virtual base_data_t*copy()const noexcept override final{return get<variable_data_t>(_m);}
13050 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override final{return type_info<variable_data_t>;}
13051 };
13052 private:
13053 mutable comn_ptr_t<base_data_t> _m;
13054 public:
13055 explicit value()noexcept:_m(get<variable_data_t>(null_ptr)){}
13056 constexpr explicit value(special_init_t)noexcept:_m(null_ptr){}
13057 explicit value(ptr a)noexcept:_m(get<constexpr_data_t>(a)){}
13058 explicit value(node_like* a)noexcept:value(ptr(a)){}
13059 value(base_data_t*a)noexcept:_m(a){}
13060
13061 value(const this_t&a)noexcept=default;
13062 value(this_t&&a)noexcept=default;
13063 ~value()noexcept=default;
13064
13065 this_t&operator=(ptr a){
13066 _m->be_set(a);
13067 return *this;
13068 }
13069 this_t&operator=(auto&&a){
13070 return operator=(as_ptr(a));
13071 }
13072
13073 [[nodiscard]]operator ptr(){
13074 return _m->get_value();
13075 }
13076 [[nodiscard]]operator const_ptr()const{
13077 return _m->get_value();
13078 }
13079 [[nodiscard]]ptr operator&(){
13080 return operator ptr();
13081 }
13082 [[nodiscard]]const_ptr operator&()const{
13083 return operator const_ptr();
13084 }
13085 [[nodiscard]]explicit operator bool()const{return bool(_m->get_value());}
13086
13087 void ref_to(this_t a)noexcept{
13088 _m.do_replace(a._m);
13089 }
13090 void un_ref()noexcept{
13091 _m=_m->copy();
13092 }
13093 void re_ref_to(this_t a)noexcept{
13094 _m=a._m;
13095 }
13096 this_t& operator>>(this_t a)noexcept{
13097 a.ref_to(*this);
13098 return*this;
13099 }
13100
13101 template<typename T>
13102 [[nodiscard]]auto operator[](T&&index){
13103 return (*operator&())[forward<T>(index)];
13104 }
13105 template<typename...Args> requires(invoke<node_like>.able<Args...>)
13106 inline auto operator()(Args&&... rest)noexcept(invoke<node_like>.nothrow<Args...>){return(*operator&())(forward<Args>(rest)...);}
13107 [[nodiscard]]auto operator==(auto&&a)const noexcept{
13108 try{
13109 return const_ptr(*this) == const_ptr(as_value(a));
13110 }
13111 catch(...){
13112 return unknown;
13113 }
13114 }
13115 [[nodiscard]]auto operator!=(auto&&a)const{
13116 return !operator==(a);
13117 }
13118 [[nodiscard]]operator ptr::for_delete_t*(){
13119 return _m->get_value();
13120 }
13121 };
13122
13123 static value::base_data_t*the_get_null_ptr(const value::base_data_t*)noexcept{
13124 return&value::null_data;
13125 }
13126
13127 BREAK_NAMESPACE
13128
13129 INTER_NAMESPACE(base)
13130 template<>
13131 distinctive inline core::value const_default_value_of<core::value>{special_init};
13132 BREAK_NAMESPACE
13133
13134 INTER_NAMESPACE(core)
13135
13136 //file_end
13137
13138 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/_body.hpp"
13139
13140 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/node_like_using_value_func_defs.hpp"
13141 //defs.hpp
13142 //at namespace elc::defs::core
13143 /*
13144 未完成的elc解释器core文件
13145 由steve02081504与Alex0125设计、编写
13146 转载时请在不对此文件做任何修改的同时注明出处
13147 项目地址:https://github.com/steve02081504/ELC
13148 */
13149 push_and_disable_msvc_warning(26440);//nothrow警告diss
13150 [[nodiscard]]inline value node_like::be_eval(){
13151 return value(this);
13152 }
13153 [[nodiscard]]inline value node_like::be_call(ptr){
13154 return value(this);
13155 }
13156 pop_msvc_warning();
13157
13158 [[nodiscard]]inline value node_like::operator[](const value index){
13159 return arec(index);
13160 }
13161
13162 //file_end
13163
13164 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/base_def/_body.hpp"
13165
13166 //file_end
13167
13168 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
13169 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/runtime_exception/_body.hpp"
13170 //_body.hpp
13171 //at namespace elc::defs::base
13172 /*
13173 未完成的elc解释器base文件
13174 由steve02081504与Alex0125设计、编写
13175 转载时请在不对此文件做任何修改的同时注明出处
13176 项目地址:https://github.com/steve02081504/ELC
13177 */
13178 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/runtime_exception/base_runtime_exception.hpp"
13179 //base_runtime_exception.hpp
13180 //at namespace elc::defs::base
13181 /*
13182 未完成的elc解释器base文件
13183 由steve02081504与Alex0125设计、编写
13184 转载时请在不对此文件做任何修改的同时注明出处
13185 项目地址:https://github.com/steve02081504/ELC
13186 */
13187 struct base_runtime_exception:runtime_exception{
13188 using runtime_exception::runtime_exception;
13189 };
13190
13191 //file_end
13192
13193 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/runtime_exception/_body.hpp"
13194 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/runtime_exception/core_runtime_internal_helper.hpp"
13195 //_body.hpp
13196 //at namespace elc::defs::base
13197 /*
13198 未完成的elc解释器base文件
13199 由steve02081504与Alex0125设计、编写
13200 转载时请在不对此文件做任何修改的同时注明出处
13201 项目地址:https://github.com/steve02081504/ELC
13202 */
13203 namespace core_runtime_internal_helper_n{
13205 using base_runtime_exception::base_runtime_exception;
13206 constexpr base_t()noexcept:
13207 base_runtime_exception(locale::str::exception::core_runtime_internal_helper_leak){}
13208 };
13209 //
13211 ptr to;
13212 };
13214 }
13215 //#include ".hpp"
13216
13217 //file_end
13218
13219 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/runtime_exception/_body.hpp"
13220
13221 //file_end
13222
13223 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
13224 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/_body.hpp"
13225 //_body.hpp
13226 //at namespace elc::defs::base
13227 /*
13228 未完成的elc解释器base文件
13229 由steve02081504与Alex0125设计、编写
13230 转载时请在不对此文件做任何修改的同时注明出处
13231 项目地址:https://github.com/steve02081504/ELC
13232 */
13233 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/base_constexpr.hpp"
13234 //base_constexpr.hpp
13235 //at namespace elc::defs::core
13236 /*
13237 未完成的elc解释器base文件
13238 由steve02081504与Alex0125设计、编写
13239 转载时请在不对此文件做任何修改的同时注明出处
13240 项目地址:https://github.com/steve02081504/ELC
13241 */
13242 struct base_constexpr_t:node_like,instance_struct<base_constexpr_t>{
13243 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<base_constexpr_t>;}
13244 protected:
13245 [[nodiscard]]virtual constexpr size_t equal_level()const noexcept override{return magic_number::god;}
13246 [[nodiscard]]virtual constexpr size_t eq_level()const noexcept override{return magic_number::god;}
13247 public:
13248 base_constexpr_t()noexcept:node_like(never_ref_num_zero){}
13249 constexpr virtual ~base_constexpr_t()noexcept override=default;
13250
13251 [[nodiscard]]virtual value arec(const value)noexcept override{return value(this);}
13252
13253 virtual void clear()noexcept override final{nothing}
13254
13255 virtual void be_replace_as(ptr)noexcept override{nothing}
13256 };
13257
13258 //file_end
13259
13260 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/_body.hpp"
13261 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/void.hpp"
13262 //void.hpp
13263 //at namespace elc::defs::core
13264 /*
13265 未完成的elc解释器base文件
13266 由steve02081504与Alex0125设计、编写
13267 转载时请在不对此文件做任何修改的同时注明出处
13268 项目地址:https://github.com/steve02081504/ELC
13269 */
13270 /*
13271 使用elc::the_void来访问此值
13272 或者通过包含<elc/void_name>来使用elc::void访问此值,并使用::void来访问c艹的原生void
13273 */
13274 distinctive inline struct void_t final:base_constexpr_t{
13275 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<void_t>;}
13276 protected:
13277 [[nodiscard]]virtual constexpr size_t equal_level()const noexcept override{return max(type_info<size_t>);}
13278 [[nodiscard]]virtual constexpr size_t eq_level()const noexcept override{return max(type_info<size_t>);}
13279 [[nodiscard]]virtual logical_bool equal_with(const_ptr a)const noexcept override{
13280 if(this==a)
13281 return either;//当void是void时,void不是void
13282 else
13283 return neither;//当a不是void时,void是a
13284 }
13285 //我不知道为什么这么写,反正很有趣
13286 public:
13287 [[nodiscard]]virtual constexpr explicit operator hash_t()const noexcept override{return hash(nothing);}
13288 [[nodiscard]]virtual constexpr explicit operator logical_bool()const noexcept override{return neither;}//void 应当不真不假
13289 }the_void{};
13290
13291 [[nodiscard]]constexpr node_like*the_get_null_ptr(const node_like*)noexcept{return addressof((node_like&)the_void);}
13292
13293 //file_end
13294
13295 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/_body.hpp"
13296 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/nil.hpp"
13297 //nil.hpp
13298 //at namespace elc::defs::core
13299 /*
13300 未完成的elc解释器base文件
13301 由steve02081504与Alex0125设计、编写
13302 转载时请在不对此文件做任何修改的同时注明出处
13303 项目地址:https://github.com/steve02081504/ELC
13304 */
13305 distinctive inline struct nil_t final:base_constexpr_t{
13306 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<nil_t>;}
13307 protected:
13308 [[nodiscard]]virtual logical_bool equal_with(const_ptr a)const noexcept override{return !logical_bool(a);}
13309 public:
13310 [[nodiscard]]virtual constexpr explicit operator hash_t()const noexcept override{return hash(false);}
13311 [[nodiscard]]virtual constexpr explicit operator logical_bool()const noexcept override{return false;}
13312 }nil{};
13313
13314 //file_end
13315
13316 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/_body.hpp"
13317 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/t.hpp"
13318 //t.hpp
13319 //at namespace elc::defs::core
13320 /*
13321 未完成的elc解释器base文件
13322 由steve02081504与Alex0125设计、编写
13323 转载时请在不对此文件做任何修改的同时注明出处
13324 项目地址:https://github.com/steve02081504/ELC
13325 */
13326 distinctive inline struct t_t final:base_constexpr_t{
13327 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<t_t>;}
13328 protected:
13329 [[nodiscard]]virtual logical_bool equal_with(const_ptr a)const noexcept override{return logical_bool(a);}
13330 public:
13331 [[nodiscard]]virtual constexpr explicit operator hash_t()const noexcept override{return hash(true);}
13332 [[nodiscard]]virtual constexpr explicit operator logical_bool()const noexcept override{return true;}
13333
13334 //nothing is true,everything is permitted.
13335 [[noreturn]]virtual void be_replace_as(ptr)noexcept override{::std::exit(0);}
13336 }t{};
13337
13338 //file_end
13339
13340 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/special_values/_body.hpp"
13341
13342 //file_end
13343
13344 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
13345 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/_body.hpp"
13346 //_body.hpp
13347 //at namespace elc::defs::core
13348 /*
13349 未完成的elc解释器core文件
13350 由steve02081504与Alex0125设计、编写
13351 转载时请在不对此文件做任何修改的同时注明出处
13352 项目地址:https://github.com/steve02081504/ELC
13353 */
13354 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/common_node.hpp"
13355 //common_node.hpp
13356 //at namespace elc::defs::core
13357 /*
13358 未完成的elc解释器core文件
13359 由steve02081504与Alex0125设计、编写
13360 转载时请在不对此文件做任何修改的同时注明出处
13361 项目地址:https://github.com/steve02081504/ELC
13362 */
13363 struct common_node:node_like,instance_struct<common_node>{
13364 typedef common_node this_t;
13365
13366 map_t<value,const_weak_ptr> _m;
13367
13368 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<this_t>;}
13369 protected:
13370 [[nodiscard]]virtual logical_bool equal_with(const_ptr a)const noexcept override{
13371 if(a->get_type_info() != this->get_type_info())
13372 return false;
13373 const this_t*p=down_cast<const this_t*>(a.get());
13374 return _m==p->_m;
13375 }
13376 public:
13377 [[nodiscard]]virtual value arec(const value index)override{return _m[&index];}
13378
13379 virtual void clear()noexcept override{_m.clear();}
13380 };
13381
13382 //file_end
13383
13384 #line 9 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/_body.hpp"
13385 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/cons.hpp"
13386 //common_node.hpp
13387 //at namespace elc::defs::core
13388 /*
13389 未完成的elc解释器core文件
13390 由steve02081504与Alex0125设计、编写
13391 转载时请在不对此文件做任何修改的同时注明出处
13392 项目地址:https://github.com/steve02081504/ELC
13393 */
13394 inline value car_of(ptr p){
13395 return (*p)[t];
13396 }
13397 inline value cdr_of(ptr p){
13398 return (*p)[nil];
13399 }
13400 inline value car_of(auto&&node){
13401 return car_of(as_ptr(node));
13402 }
13403 inline value cdr_of(auto&&node){
13404 return cdr_of(as_ptr(node));
13405 }
13406
13407 struct cons:node_like,instance_struct<cons>{
13408 typedef cons this_t;
13409
13410 value _car;
13411 value _cdr;
13412
13413 cons(ptr car,ptr cdr){
13414 _car = car;
13415 _cdr = cdr;
13416 }
13417
13418 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<cons>;}
13419 protected:
13420 [[nodiscard]]virtual logical_bool equal_with(const_ptr a)const noexcept override{
13421 if(a->get_type_info() != this->get_type_info())
13422 return false;
13423 const this_t*p=down_cast<const this_t*>(a.get());
13424 return _car==p->_car&&_cdr==p->_cdr;
13425 }
13426 public:
13427 [[nodiscard]]virtual value arec(const value index)override{
13428 const_ptr v=index;
13429 if(v==&nil)
13430 return _cdr;
13431 elseif(v==&t)
13432 return _car;
13433 else{
13434 ptr to=get<common_node>();
13435 _car >> car_of(to);
13436 _cdr >> cdr_of(to);
13437 be_replace_as(to);
13438 return (*to)[v];
13439 }
13440 }
13441
13442 virtual void clear()noexcept override{as_value(&the_void)>>_car>>_cdr;}
13443 };
13444
13445 [[nodiscard]]inline ptr make_list()noexcept{return &nil;}
13446 template<typename T,typename...Args>
13447 [[nodiscard]]inline ptr make_list(T&&first,Args&&...rest){
13448 ELC_TEST_EVENTNAME("make_list调用");
13449 return get<cons>(as_ptr(first),make_list(forward<Args>(rest)...));
13450 }
13451
13452 //file_end
13453
13454 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/_body.hpp"
13455 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/expr.hpp"
13456 //expr.hpp
13457 //at namespace elc::defs::core
13458 /*
13459 未完成的elc解释器core文件
13460 由steve02081504与Alex0125设计、编写
13461 转载时请在不对此文件做任何修改的同时注明出处
13462 项目地址:https://github.com/steve02081504/ELC
13463 */
13464 struct expr:cons,instance_struct<expr>{
13465 typedef expr this_t;
13466 override_instance_struct;
13467 public:
13468 using cons::_car;
13469 using cons::_cdr;
13470 using cons::cons;
13471
13472 [[nodiscard]]virtual value be_eval()override{
13473 return as_ptr(_car)->be_call(_cdr);
13474 }
13475 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<expr>;}
13476 };
13477
13478 //file_end
13479
13480 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/_body.hpp"
13481 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/base_binary_function_node.hpp"
13482 //base_binary_function_node.hpp
13483 //at namespace elc::defs::core
13484 /*
13485 未完成的elc解释器core文件
13486 由steve02081504与Alex0125设计、编写
13487 转载时请在不对此文件做任何修改的同时注明出处
13488 项目地址:https://github.com/steve02081504/ELC
13489 */
13490 struct base_binary_function_node:node_like,instance_struct<base_binary_function_node>{
13492
13493 function_t<value(ptr)> _func;
13494
13495 base_binary_function_node(function_t<value(ptr)> func)noexcept:_func(func){}
13496 base_binary_function_node(function_t<void(ptr)> func)noexcept{
13497 _func = lambda_with_catch(func)(ptr p)mutable{
13498 func(p);
13499 return as_value(the_void);
13500 };
13501 }
13502 base_binary_function_node(function_t<void()> func)noexcept{
13503 _func = lambda_with_catch(func)(ptr)mutable{
13504 func();
13505 return as_value(the_void);
13506 };
13507 }
13508
13509 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<this_t>;}
13510 [[nodiscard]]virtual value be_call(ptr arg_list)override{return _func(arg_list);}
13511 protected:
13512 [[nodiscard]]virtual logical_bool equal_with(const_ptr a)const noexcept override{
13513 if(a->get_type_info() != this->get_type_info())
13514 return false;
13515 const this_t*p=down_cast<const this_t*>(a.get());
13516 try{
13517 return _func==p->_func;
13518 }
13519 catch(...){
13520 return unknown;
13521 }
13522 }
13523 public:
13524 [[nodiscard]]virtual value arec(const value index)override{return the_void[index];}
13525
13526 virtual void clear()noexcept override{_func=nullptr;}
13527 };
13528
13529 //file_end
13530
13531 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/_body.hpp"
13532 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/binary_node_t.hpp"
13533 //binary_node_t.hpp
13534 //at namespace elc::defs::core
13535 /*
13536 未完成的elc解释器core文件
13537 由steve02081504与Alex0125设计、编写
13538 转载时请在不对此文件做任何修改的同时注明出处
13539 项目地址:https://github.com/steve02081504/ELC
13540 */
13542 typedef binary_node_base_t this_t;
13543
13544 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override final{return type_info<this_t>;}
13545 [[nodiscard]]virtual base_type_info_t get_additional_type_info()const noexcept=0;
13546 protected:
13547 [[noreturn]] virtual void throw_self_ptr()const=0;
13548 [[noreturn]] virtual void throw_self_ptr()=0;
13549 template<typename T>
13550 friend[[nodiscard]]inline maybe_fail_reference<T> maybe_fail_use_by_ref_as(ptr p)noexcept;
13551 template<typename T>
13552 friend[[nodiscard]]inline maybe_fail_reference<T> maybe_fail_use_by_ref_as(ptr p)noexcept;
13553 template<typename T>
13554 friend[[nodiscard]]inline const T& const_use_by_ref_as(const_ptr p)noexcept;
13555 };
13556 template<typename T>
13557 struct binary_node_t:binary_node_base_t,instance_struct<binary_node_t<T>>{
13558 typedef binary_node_t<T> this_t;
13559 typedef binary_node_base_t base_t;
13560
13561 T _m;
13562
13563 binary_node_t(const T&a)noexcept:_m(a){}
13564 binary_node_t(T&&a)noexcept:_m(a){}
13565
13566 [[nodiscard]]virtual base_type_info_t get_additional_type_info()const noexcept override{return type_info<this_t>;}
13567 private:
13568 static constexpr bool hash_nothrow_helper=hash.able<T>?
13569 hash.nothrow<T>:1;
13570 public:
13571 [[nodiscard]]virtual explicit operator hash_t()const noexcept(hash_nothrow_helper)override{
13572 if constexpr(hash.able<T>)
13573 return hash(_m);
13574 else
13575 #if defined(_MSC_VER)
13576 [[gsl::suppress(f.6)]]
13577 #endif
13578 return node_like::operator hash_t();
13579 }
13580 protected:
13581 [[noreturn]] virtual void throw_self_ptr()const override{throw&_m;}
13582 [[noreturn]] virtual void throw_self_ptr()override{throw&_m;}
13583 [[nodiscard]]virtual logical_bool eq_with(const_ptr a)const noexcept override{
13584 using defs::equal;//貌似msvc在这里有bug
13585 if constexpr(equal.able<T>){
13586 if(a->get_type_info() != this->get_type_info())
13587 return false;
13588 const base_t*base_p=down_cast<const base_t*>(a.get());
13589 if(base_p->get_type_info() != this->get_type_info())
13590 return false;
13591 const this_t*p=down_cast<const this_t*>(base_p);
13592 return _m==p->_m;
13593 }
13594 else
13595 return node_like::eq_with(a);
13596 }
13597 [[nodiscard]]virtual logical_bool equal_with(const_ptr a)const noexcept override{
13598 return eq_with(a);
13599 }
13600 private:
13601 static constexpr bool arec_nothrow_helper=was_not_an_ill_form(arec_as_value(_m,declvalue(const value&)))?
13602 was_not_an_ill_form_and_noexcept(arec_as_value(_m,declvalue(const value&))):1;
13603 public:
13604 [[nodiscard]]virtual value arec(const value index)noexcept(arec_nothrow_helper)override{
13605 if constexpr(was_not_an_ill_form(arec_as_value(_m,index)))
13606 return arec_as_value(_m,index);
13607 else
13608 return as_value(this);
13609 }
13610 private:
13611 static constexpr bool clear_nothrow_helper= was_not_an_ill_form(declvalue(T).clear())?
13612 was_not_an_ill_form_and_noexcept(declvalue(T).clear()):
13613 re_construct.nothrow<T>;
13614 public:
13615 virtual void clear()noexcept(clear_nothrow_helper)override{
13616 if constexpr(was_not_an_ill_form(declvalue(T).clear()))
13617 _m.clear();
13618 else
13619 re_construct(&_m);
13620 }
13621 };
13622
13623 template<typename T>
13624 [[nodiscard]]inline bool was_an(const_ptr p)noexcept{
13625 typedef binary_node_t<T> target_node_t;
13626 if(p->get_type_info() == type_info<binary_node_base_t>){
13627 auto base_p = down_cast<const binary_node_base_t*>(p.get());
13628 if(base_p->get_additional_type_info() == type_info<target_node_t>)
13629 return true;
13630 elseif constexpr(::std::is_class_v<T> && !::std::is_final_v<T>){
13631 try{
13632 base_p->throw_self_ptr();
13633 }
13634 catch(const T*){
13635 return true;
13636 }
13637 catch(const void*){}
13638 }
13639 }
13640 return false;
13641 }
13642 template<typename T>
13643 [[nodiscard]]inline maybe_fail_reference<T> maybe_fail_use_by_ref_as(ptr p)noexcept{
13644 typedef binary_node_t<T> target_node_t;
13645 if(p->get_type_info() == type_info<binary_node_base_t>){
13646 auto base_p = down_cast<binary_node_base_t*>(p.get());
13647 if(base_p->get_additional_type_info() == type_info<target_node_t>)
13648 return down_cast<target_node_t*>(base_p)->_m;
13649 elseif constexpr(::std::is_class_v<T> && !::std::is_final_v<T>){
13650 try{
13651 base_p->throw_self_ptr();
13652 }
13653 catch(T*aret){
13654 return*aret;
13655 }
13656 catch(void*){}
13657 }
13658 }
13659 return note::fail;
13660 }
13661 template<typename T>
13662 [[nodiscard]]inline T& use_by_ref_as(ptr p)noexcept{
13663 return maybe_fail_use_by_ref_as<T>(p).get_ref();
13664 }
13665 template<typename T>
13666 [[nodiscard]]inline const T& const_use_by_ref_as(const_ptr p)noexcept{
13667 typedef binary_node_t<T> target_node_t;
13668 if(p->get_type_info() == type_info<binary_node_base_t>){
13669 auto base_p = down_cast<const binary_node_base_t*>(p.get());
13670 if(base_p->get_additional_type_info() == type_info<target_node_t>)
13671 return down_cast<const target_node_t*>(base_p)->_m;
13672 elseif constexpr(::std::is_class_v<T> && !::std::is_final_v<T>){
13673 try{
13674 base_p->throw_self_ptr();
13675 }
13676 catch(const T*aret){
13677 return*aret;
13678 }
13679 catch(const void*){}
13680 }
13681 }
13682 return const_default_value_of<T>;
13683 }
13684 template<typename T>
13685 [[nodiscard]]inline T use_as(const_ptr p)noexcept{
13686 return const_use_by_ref_as<T>(p);
13687 }
13688 template<typename T>
13689 [[nodiscard]]inline const T& use_by_ref_as(const_ptr p)noexcept{
13690 return const_use_by_ref_as<T>(p);
13691 }
13692 template<typename T>
13693 [[nodiscard]]inline const T& use_by_ref_as(auto&&a)noexcept{
13694 return use_by_ref_as<T>(as_ptr(a));
13695 }
13696 template<typename T>
13697 [[nodiscard]]inline ptr make_binary_node_from(T a)noexcept{
13698 return get<binary_node_t<T>>(move(a));
13699 }
13700 template<typename T>
13701 distinctive inline map_t<ptr,T> long_term_binary_node_storager{};
13702 template<typename T>
13703 [[nodiscard]]inline ptr make_long_term_binary_node_from(T a)noexcept{
13704 ptr& to = long_term_binary_node_storager<T>[a];
13705 if(!bool(to) || const_use_by_ref_as<T>(to)!=a)
13706 to = make_binary_node_from<T>(move(a));
13707 return to;
13708 }
13709
13710 //file_end
13711
13712 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/_body.hpp"
13713 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/code_list.hpp"
13714 //code_list.hpp
13715 //at namespace elc::defs::core
13716 /*
13717 未完成的elc解释器core文件
13718 由steve02081504与Alex0125设计、编写
13719 转载时请在不对此文件做任何修改的同时注明出处
13720 项目地址:https://github.com/steve02081504/ELC
13721 */
13722 inline value eval(ptr p){
13723 return p->be_eval();
13724 }
13725 inline value eval(auto&&node){
13726 return eval(as_ptr(node));
13727 }
13728 struct code_list:cons,instance_struct<code_list>{
13729 typedef code_list this_t;
13730 override_instance_struct;
13731 public:
13732 using cons::cons;
13733
13734 [[nodiscard]]virtual value be_eval()override{
13735 ptr self = this;
13736 value aret{special_init};
13737 from_goto:
13738 try{
13739 do{
13740 eval(car_of(self)) >> aret;
13741 self=cdr_of(self);
13742 }while(self);
13743 }
13745 self=info.to;
13746 goto from_goto;
13747 }
13749 }
13750 return aret;
13751 }
13752 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override{return type_info<code_list>;}
13753 };
13754
13755 //file_end
13756
13757 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/nodes/_body.hpp"
13758
13759 //file_end
13760
13761 #line 19 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
13762 }
13763
13764 #if defined(ELC_TEST_ON)
13765 namespace core_part_test{
13766 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_test.hpp"
13767 //_test.hpp
13768 /*
13769 未完成的elc解释器core文件
13770 由steve02081504与Alex0125设计、编写
13771 转载时请在不对此文件做任何修改的同时注明出处
13772 项目地址:https://github.com/steve02081504/ELC
13773 */
13774 inline void test(){
13775 ELC_TEST_EVENTNAME("core部分测试");
13776 }
13777 inline void test_log_out(){
13778 }
13779 inline void test_end(){
13780 }
13781
13782 //file_end
13783
13784 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
13785 }
13786 #endif
13787
13788 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
13789 //_undefs.hpp
13790 /*
13791 未完成的elc解释器basic文件
13792 由steve02081504与Alex0125设计、编写
13793 转载时请在不对此文件做任何修改的同时注明出处
13794 项目地址:https://github.com/steve02081504/ELC
13795 */
13796 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
13797 //_undefs.hpp
13798 /*
13799 未完成的elc解释器_share文件
13800 由steve02081504与Alex0125设计、编写
13801 转载时请在不对此文件做任何修改的同时注明出处
13802 项目地址:https://github.com/steve02081504/ELC
13803 */
13804
13805 //defs at "_defs.hpp"
13806
13807 #if defined(_MSC_VER)
13808 #pragma warning(pop)
13809 #endif
13810 #undef suppress_msvc_warning
13811 #undef disable_msvc_warning
13812 #undef push_msvc_warning
13813 #undef pop_msvc_warning
13814 #undef push_and_disable_msvc_warning
13815
13816 //for basic_environment.hpp
13817 #undef BIT_POSSIBILITY
13818 //
13819 #if defined(ELC_VOID_NAME)
13820 #define void the_void
13821 #endif
13822
13823 // #undef often_noexcept
13824 #undef noexcept_as
13825 #undef noexcept_as_auto
13826 #undef constexpr_as
13827 #undef constexpr_as_auto
13828
13829 #undef using_method_from_base_t
13830 #undef using_method_from_value
13831
13832 #undef floop
13833 #undef enable_adl
13834
13835 #undef re_declvalue
13836 #undef re_decltype
13837
13838 #undef declvalue
13839
13840 #undef template_error
13841 #undef template_warning
13842
13843 #undef type_info_of
13844 #undef type_name_of
13845
13846 #undef is_common_attribute
13847 #undef is_special_attribute
13848
13849 #undef has_attribute
13850 #undef not_has_attribute
13851
13852 #undef float_size_of
13853 #undef bitnum_of
13854
13855 #undef def_common_attribute_with_nothing
13856 #undef def_special_attribute_with_nothing
13857
13858 #undef common_attribute_t
13859 #undef special_attribute_t
13860
13861 #undef enable_if
13862 #undef enabled_by_default
13863 #undef disabled_by_default
13864 #undef enable_if_not_ill_form
13865 #undef enable_flag
13866
13867 #undef was_an_ill_form
13868 #undef was_an_ill_form_with_parameter
13869 #undef was_not_an_ill_form
13870 #undef was_not_an_ill_form_and_noexcept
13871 #undef was_not_an_ill_form_with_parameter
13872
13873 #undef recursive_lambda
13874 #undef get_recursive_lambda_caller
13875 #undef lambda
13876 #undef lambda_with_catch
13877 #undef self_recursion
13878 #undef lambda_RLSRRS
13879
13880 #undef MAGIC
13881
13882 #undef nothing
13883
13884 #undef elseif
13885 #undef _big_than_
13886 #undef _small_than_
13887
13888 #if defined(_MSC_VER)
13889 #undef not
13890 #undef and
13891 #undef or
13892 #endif
13893
13894 #undef INTER_NAMESPACE
13895 #undef BREAK_NAMESPACE
13896
13897 #undef szie
13898 #undef form
13899
13900 #undef template_name
13901 #undef type_name
13902
13903 #undef not_in_debug
13904
13905 #undef es
13906 #undef ec
13907
13908 #undef ELC_TEST_EVENTNAME
13909
13910 #undef override_instance_struct
13911
13912 #undef distinctive
13913
13914 #undef force_inline
13915
13916 #undef with_no_vtable
13917
13918 #undef in_consteval
13919
13920 #undef no_vtable_struct
13921 #undef no_vtable_class
13922
13923 //file_end
13924
13925 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
13926
13927 //file_end
13928
13929 #line 28 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
13930 }
13931 namespace elc{
13932 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_export.hpp"
13933 //_export.hpp
13934 //at namespace elc
13935 /*
13936 未完成的elc解释器core文件
13937 由steve02081504与Alex0125设计、编写
13938 转载时请在不对此文件做任何修改的同时注明出处
13939 项目地址:https://github.com/steve02081504/ELC
13940 */
13941 #define export using defs::core::
13942 export node_like;
13943 export ptr;
13944 export const_ptr;
13945 export weak_ptr;
13946 export const_weak_ptr;
13947 export value;
13948
13949 export nil;
13950 export t;
13951 export the_void;
13952
13953 export as_value;
13954 export as_ptr;
13955 export common_node;
13956 #undef export
13957
13958 //file_end
13959
13960 #line 31 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
13961 }
13962 #if defined(ELC_STRING)
13963 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_multi/string_arec_as_value.hpp"
13964 //string_arec_as_value.hpp
13965 //at namespace ::
13966 //multi when ELC_STRING & ELC_CORE
13967 /*
13968 未完成的elc解释器string文件
13969 由steve02081504与Alex0125设计、编写
13970 转载时请在不对此文件做任何修改的同时注明出处
13971 项目地址:https://github.com/steve02081504/ELC
13972 */
13973 namespace elc::defs{
13974 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
13975 //_defs.hpp
13976 /*
13977 未完成的elc解释器basic文件
13978 由steve02081504与Alex0125设计、编写
13979 转载时请在不对此文件做任何修改的同时注明出处
13980 项目地址:https://github.com/steve02081504/ELC
13981 */
13982 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
13983 //_defs.hpp
13984 /*
13985 未完成的elc解释器_share文件
13986 由steve02081504与Alex0125设计、编写
13987 转载时请在不对此文件做任何修改的同时注明出处
13988 项目地址:https://github.com/steve02081504/ELC
13989 */
13990
13991 //undefs at "_undefs.hpp"
13992
13993 //set ELC_WARNING_LEVEL default to 4(max)
13994 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
13995
13996 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
13997 //basic_environment.hpp
13998 /*
13999 未完成的elc解释器_share文件
14000 由steve02081504与Alex0125设计、编写
14001 转载时请在不对此文件做任何修改的同时注明出处
14002 项目地址:https://github.com/steve02081504/ELC
14003 */
14004
14005 //每个bit(不是字节)的可能性
14006 //为什么c艹委员会不定义这个?
14007 #define BIT_POSSIBILITY 2
14008
14009 //file_end
14010
14011 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
14012
14013 #if defined(_MSC_VER)
14014 #pragma warning(push,ELC_WARNING_LEVEL)
14015 #pragma warning(disable:4099)//class与struct混用警告diss
14016 #pragma warning(disable:26812)//enum class安利diss.
14017 #pragma warning(disable:4584)//重复子类警告diss
14018 #pragma warning(disable:4250)//域控制继承警告diss
14019 #pragma warning(disable:26432)//不完全默认方法警告diss
14020 #pragma warning(disable:26435)//virtual override方法警告diss
14021 #pragma warning(disable:26481)//容器安利diss
14022 #pragma warning(disable:26446)//gsl::at安利diss
14023 #pragma warning(disable:26434)//方法覆盖警告diss
14024 #pragma warning(disable:26429)//gsl::not_null安利diss
14025 #pragma warning(disable:26471)//对void*进行static_cast安利diss
14026 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
14027 #pragma warning(disable:26473)//相同指针显式cast警告diss
14028 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
14029 #pragma warning(disable:26485)//数组作指针警告diss
14030 #pragma warning(disable:26490)//reinterpret_cast警告diss
14031 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
14032 #pragma warning(disable:26482)//非常数数组索引警告diss
14033 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
14034 #endif
14035 #if defined(_MSC_VER)
14036 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
14037 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
14038 #define push_msvc_warning() __pragma(warning(push))
14039 #define pop_msvc_warning() __pragma(warning(pop))
14040 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
14041 #else
14042 #define suppress_msvc_warning(...)
14043 #define disable_msvc_warning(...)
14044 #define push_msvc_warning()
14045 #define pop_msvc_warning()
14046 #define push_and_disable_msvc_warning(...)
14047 #endif
14048 //
14049 #if defined(ELC_VOID_NAME)
14050 #undef void
14051 #endif
14052
14053 // #define often_noexcept
14054 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
14055 #define noexcept_as_auto MAGIC//哦现在有了
14056 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
14057 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
14058
14059 #define using_method_from_base_t(name,...) \
14060 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
14061 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
14062 {\
14063 return base_t::name(forward<Args>(rest)...);\
14064 }\
14065
14066 #define using_method_from_value(name,value_name,...) \
14067 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
14068 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
14069 {\
14070 return value_name.name(forward<Args>(rest)...);\
14071 }\
14072
14073 #define floop while(__builtin_is_my_dick_still_there())
14074 #define enable_adl(name) void name()noexcept=delete
14075
14076 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
14077 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
14078
14079 #define declvalue(...) (::std::declval<__VA_ARGS__>())
14080
14081 /*实例化到此将引发错误*/
14082 #define template_error(reason) static_assert(template_error_helper<T>,reason)
14083 /*实例化到此将引发警告*/
14084 #define template_warning(reason) template_warning_helper<T>(reason)
14085
14086 //for type_info
14087 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
14088 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
14089
14090 #define is_common_attribute(name) public attribute<T,name<T>>
14091 #define is_special_attribute(name) public attribute<T,name>
14092
14093 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
14094 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
14095
14096 //for float_size_t
14097 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
14098 //bitnum_of
14099 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
14100
14101 //for attribute
14102 #define def_common_attribute_with_nothing(name) \
14103 template<typename T>\
14104 class name{}\
14105
14106 #define def_special_attribute_with_nothing(name) \
14107 class name{}\
14108
14109 #define common_attribute_t template<class>class
14110 #define special_attribute_t class
14111
14112 /*
14113 若参数的布尔值为零,那么此模板不会实例化
14114
14115 为什么不用cpp20的constraints?
14116 1.不能类内定义
14117 2.不能作为模板参数
14118 一句话总结:c艹标准会sb
14119 */
14120 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
14121 /*默认参与模板候选*/
14122 #define enabled_by_default class enable_state=void
14123 /*默认不参与模板候选*/
14124 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
14125 /*若参数为病式,那么此模板不会实例化*/
14126 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
14127 /*用于模板声明*/
14128 #define enable_flag class enable_state
14129
14130 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
14131 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
14132 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
14133 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
14134 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
14135
14136 /*让lambda递归更加美观*/
14137 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
14138 /*让lambda递归更加美观*/
14139 #define get_recursive_lambda_caller(name) \
14140 lambda_with_catch(&)(auto&&...Args){\
14141 return name(name,Args...);\
14142 }
14143 /*让lambda定义更加美观*/
14144 #define lambda []
14145 /*让lambda定义更加美观*/
14146 #define lambda_with_catch(...) [__VA_ARGS__]
14147 /*让lambda递归更加美观*/
14148 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
14149 //recursive_lambda_self_referential_reserved_symbolname
14150 #define lambda_RLSRRS _my_jb_super_sb_name_
14151
14152 #define MAGIC//ahh,ko no tenno da!
14153
14154 /*装饰性语法糖*/
14155 #define nothing
14156
14157 /*aya风格语法糖*/
14158 #define elseif else if
14159 /*aya风格语法糖*/
14160 #define _big_than_ >
14161 /*aya风格语法糖*/
14162 #define _small_than_ <
14163
14164 #if defined(_MSC_VER)
14165 #define not !
14166 #define and &&
14167 #define or ||
14168 #endif
14169
14170 /*进入名称空间,并不是很美观*/
14171 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
14172 /*退出名称空间,并不是很美观*/
14173 #define BREAK_NAMESPACE }
14174
14175 /*template说明符*/
14176 #define template_name template
14177 /*template说明符*/
14178 #define type_name class
14179
14180 #if defined(DEBUG) || defined(_DEBUG)
14181 #define not_in_debug 0
14182 #else
14183 #define not_in_debug 1
14184 #endif
14185
14186 #define es U""
14187 #define ec(ch) U ## ch
14188
14189 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
14190 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
14191 #else
14192 #define ELC_TEST_EVENTNAME(name)
14193 #endif
14194
14195 #define override_instance_struct \
14196 protected:\
14197 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
14198 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
14199 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
14200 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
14201 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
14202
14203 #if defined(_WIN32)
14204 #define distinctive __declspec(dllexport)
14205 #else
14206 #define distinctive
14207 #endif
14208
14209 #if defined(_WIN32)
14210 #define force_inline __forceinline
14211 #elif defined(__GNUC__)
14212 #define force_inline __attribute__((always_inline)) inline
14213 #else
14214 #define force_inline inline
14215 #endif
14216
14217 #if defined(_WIN32)
14218 #define with_no_vtable __declspec(novtable)
14219 #else
14220 #define with_no_vtable
14221 #endif
14222
14223 #define in_consteval (::std::is_constant_evaluated())
14224
14225 #define no_vtable_struct struct with_no_vtable
14226 #define no_vtable_class class with_no_vtable
14227
14228 //file_end
14229
14230 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
14231
14232 //file_end
14233
14234 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_multi/string_arec_as_value.hpp"
14235
14236 namespace string_n{
14237 template<class char_T>
14238 value arec_as_value(string_t<char_T>&str,const value index){
14239 size_t i=size_t(use_as<int_t>(index));
14240 if(!i)
14241 i=size_t(use_as<uint_t>(index));
14242 struct arec_data_t final:instance_struct<arec_data_t>
14243 ,value::base_data_t{
14244 typename string_t<char_T>::arec_t _m;
14245 arec_data_t(string_t<char_T>&str,size_t index)noexcept:_m(&str,index){};
14246 arec_data_t(const arec_data_t&ref)noexcept:_m(special_init,ref._m){}
14247 virtual ~arec_data_t()noexcept override final=default;
14248
14249 virtual void be_set(ptr a)noexcept override final{move(_m)=use_as<char_T>(a);}
14250 [[nodiscard]]virtual ptr get_value()noexcept override final{return core::make_binary_node_from<char_T>(move(_m));}
14251 [[nodiscard]]virtual base_data_t*copy()const noexcept override final{return get<arec_data_t>(*this);}
14252 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override final{return type_info<arec_data_t>;}
14253 };
14254 return get<arec_data_t>(str,i);
14255 }
14256 }
14257
14258 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
14259 //_undefs.hpp
14260 /*
14261 未完成的elc解释器basic文件
14262 由steve02081504与Alex0125设计、编写
14263 转载时请在不对此文件做任何修改的同时注明出处
14264 项目地址:https://github.com/steve02081504/ELC
14265 */
14266 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
14267 //_undefs.hpp
14268 /*
14269 未完成的elc解释器_share文件
14270 由steve02081504与Alex0125设计、编写
14271 转载时请在不对此文件做任何修改的同时注明出处
14272 项目地址:https://github.com/steve02081504/ELC
14273 */
14274
14275 //defs at "_defs.hpp"
14276
14277 #if defined(_MSC_VER)
14278 #pragma warning(pop)
14279 #endif
14280 #undef suppress_msvc_warning
14281 #undef disable_msvc_warning
14282 #undef push_msvc_warning
14283 #undef pop_msvc_warning
14284 #undef push_and_disable_msvc_warning
14285
14286 //for basic_environment.hpp
14287 #undef BIT_POSSIBILITY
14288 //
14289 #if defined(ELC_VOID_NAME)
14290 #define void the_void
14291 #endif
14292
14293 // #undef often_noexcept
14294 #undef noexcept_as
14295 #undef noexcept_as_auto
14296 #undef constexpr_as
14297 #undef constexpr_as_auto
14298
14299 #undef using_method_from_base_t
14300 #undef using_method_from_value
14301
14302 #undef floop
14303 #undef enable_adl
14304
14305 #undef re_declvalue
14306 #undef re_decltype
14307
14308 #undef declvalue
14309
14310 #undef template_error
14311 #undef template_warning
14312
14313 #undef type_info_of
14314 #undef type_name_of
14315
14316 #undef is_common_attribute
14317 #undef is_special_attribute
14318
14319 #undef has_attribute
14320 #undef not_has_attribute
14321
14322 #undef float_size_of
14323 #undef bitnum_of
14324
14325 #undef def_common_attribute_with_nothing
14326 #undef def_special_attribute_with_nothing
14327
14328 #undef common_attribute_t
14329 #undef special_attribute_t
14330
14331 #undef enable_if
14332 #undef enabled_by_default
14333 #undef disabled_by_default
14334 #undef enable_if_not_ill_form
14335 #undef enable_flag
14336
14337 #undef was_an_ill_form
14338 #undef was_an_ill_form_with_parameter
14339 #undef was_not_an_ill_form
14340 #undef was_not_an_ill_form_and_noexcept
14341 #undef was_not_an_ill_form_with_parameter
14342
14343 #undef recursive_lambda
14344 #undef get_recursive_lambda_caller
14345 #undef lambda
14346 #undef lambda_with_catch
14347 #undef self_recursion
14348 #undef lambda_RLSRRS
14349
14350 #undef MAGIC
14351
14352 #undef nothing
14353
14354 #undef elseif
14355 #undef _big_than_
14356 #undef _small_than_
14357
14358 #if defined(_MSC_VER)
14359 #undef not
14360 #undef and
14361 #undef or
14362 #endif
14363
14364 #undef INTER_NAMESPACE
14365 #undef BREAK_NAMESPACE
14366
14367 #undef szie
14368 #undef form
14369
14370 #undef template_name
14371 #undef type_name
14372
14373 #undef not_in_debug
14374
14375 #undef es
14376 #undef ec
14377
14378 #undef ELC_TEST_EVENTNAME
14379
14380 #undef override_instance_struct
14381
14382 #undef distinctive
14383
14384 #undef force_inline
14385
14386 #undef with_no_vtable
14387
14388 #undef in_consteval
14389
14390 #undef no_vtable_struct
14391 #undef no_vtable_class
14392
14393 //file_end
14394
14395 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
14396
14397 //file_end
14398
14399 #line 35 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_multi/string_arec_as_value.hpp"
14400 }
14401
14402 //file_end
14403
14404 #line 34 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/core/_body.hpp"
14405 #endif
14406
14407 //file_end
14408
14409 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
14410 #endif
14411
14412 //file_end
14413
14414 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
14415 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/lib_loader"
14416 //lib_loader
14417 //at namespace ::
14418 /*
14419 未完成的elc解释器include文件
14420 由steve02081504与Alex0125设计、编写
14421 转载时请在不对此文件做任何修改的同时注明出处
14422 项目地址:https://github.com/steve02081504/ELC
14423 */
14424 #if !defined(ELC_LIB_LOADER)
14425 #define ELC_LIB_LOADER
14426 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
14427 //string
14428 //at namespace ::
14429 /*
14430 未完成的elc解释器include文件
14431 由steve02081504与Alex0125设计、编写
14432 转载时请在不对此文件做任何修改的同时注明出处
14433 项目地址:https://github.com/steve02081504/ELC
14434 */
14435 #if !defined(ELC_STRING)
14436 #define ELC_STRING
14437 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
14438 //base
14439 //at namespace ::
14440 /*
14441 未完成的elc解释器include文件
14442 由steve02081504与Alex0125设计、编写
14443 转载时请在不对此文件做任何修改的同时注明出处
14444 项目地址:https://github.com/steve02081504/ELC
14445 */
14446 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
14447
14448 //file_end
14449
14450 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
14451 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
14452 //_body.hpp
14453 //at namespace ::
14454 /*
14455 未完成的elc解释器string文件
14456 由steve02081504与Alex0125设计、编写
14457 转载时请在不对此文件做任何修改的同时注明出处
14458 项目地址:https://github.com/steve02081504/ELC
14459 */
14460 #if defined(ELC_TEST)
14461 #error "this part cannot be tested."
14462 #endif
14463 namespace elc::defs{
14464 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
14465 //_defs.hpp
14466 /*
14467 未完成的elc解释器basic文件
14468 由steve02081504与Alex0125设计、编写
14469 转载时请在不对此文件做任何修改的同时注明出处
14470 项目地址:https://github.com/steve02081504/ELC
14471 */
14472 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
14473 //_defs.hpp
14474 /*
14475 未完成的elc解释器_share文件
14476 由steve02081504与Alex0125设计、编写
14477 转载时请在不对此文件做任何修改的同时注明出处
14478 项目地址:https://github.com/steve02081504/ELC
14479 */
14480
14481 //undefs at "_undefs.hpp"
14482
14483 //set ELC_WARNING_LEVEL default to 4(max)
14484 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
14485
14486 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
14487 //basic_environment.hpp
14488 /*
14489 未完成的elc解释器_share文件
14490 由steve02081504与Alex0125设计、编写
14491 转载时请在不对此文件做任何修改的同时注明出处
14492 项目地址:https://github.com/steve02081504/ELC
14493 */
14494
14495 //每个bit(不是字节)的可能性
14496 //为什么c艹委员会不定义这个?
14497 #define BIT_POSSIBILITY 2
14498
14499 //file_end
14500
14501 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
14502
14503 #if defined(_MSC_VER)
14504 #pragma warning(push,ELC_WARNING_LEVEL)
14505 #pragma warning(disable:4099)//class与struct混用警告diss
14506 #pragma warning(disable:26812)//enum class安利diss.
14507 #pragma warning(disable:4584)//重复子类警告diss
14508 #pragma warning(disable:4250)//域控制继承警告diss
14509 #pragma warning(disable:26432)//不完全默认方法警告diss
14510 #pragma warning(disable:26435)//virtual override方法警告diss
14511 #pragma warning(disable:26481)//容器安利diss
14512 #pragma warning(disable:26446)//gsl::at安利diss
14513 #pragma warning(disable:26434)//方法覆盖警告diss
14514 #pragma warning(disable:26429)//gsl::not_null安利diss
14515 #pragma warning(disable:26471)//对void*进行static_cast安利diss
14516 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
14517 #pragma warning(disable:26473)//相同指针显式cast警告diss
14518 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
14519 #pragma warning(disable:26485)//数组作指针警告diss
14520 #pragma warning(disable:26490)//reinterpret_cast警告diss
14521 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
14522 #pragma warning(disable:26482)//非常数数组索引警告diss
14523 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
14524 #endif
14525 #if defined(_MSC_VER)
14526 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
14527 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
14528 #define push_msvc_warning() __pragma(warning(push))
14529 #define pop_msvc_warning() __pragma(warning(pop))
14530 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
14531 #else
14532 #define suppress_msvc_warning(...)
14533 #define disable_msvc_warning(...)
14534 #define push_msvc_warning()
14535 #define pop_msvc_warning()
14536 #define push_and_disable_msvc_warning(...)
14537 #endif
14538 //
14539 #if defined(ELC_VOID_NAME)
14540 #undef void
14541 #endif
14542
14543 // #define often_noexcept
14544 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
14545 #define noexcept_as_auto MAGIC//哦现在有了
14546 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
14547 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
14548
14549 #define using_method_from_base_t(name,...) \
14550 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
14551 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
14552 {\
14553 return base_t::name(forward<Args>(rest)...);\
14554 }\
14555
14556 #define using_method_from_value(name,value_name,...) \
14557 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
14558 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
14559 {\
14560 return value_name.name(forward<Args>(rest)...);\
14561 }\
14562
14563 #define floop while(__builtin_is_my_dick_still_there())
14564 #define enable_adl(name) void name()noexcept=delete
14565
14566 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
14567 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
14568
14569 #define declvalue(...) (::std::declval<__VA_ARGS__>())
14570
14571 /*实例化到此将引发错误*/
14572 #define template_error(reason) static_assert(template_error_helper<T>,reason)
14573 /*实例化到此将引发警告*/
14574 #define template_warning(reason) template_warning_helper<T>(reason)
14575
14576 //for type_info
14577 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
14578 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
14579
14580 #define is_common_attribute(name) public attribute<T,name<T>>
14581 #define is_special_attribute(name) public attribute<T,name>
14582
14583 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
14584 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
14585
14586 //for float_size_t
14587 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
14588 //bitnum_of
14589 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
14590
14591 //for attribute
14592 #define def_common_attribute_with_nothing(name) \
14593 template<typename T>\
14594 class name{}\
14595
14596 #define def_special_attribute_with_nothing(name) \
14597 class name{}\
14598
14599 #define common_attribute_t template<class>class
14600 #define special_attribute_t class
14601
14602 /*
14603 若参数的布尔值为零,那么此模板不会实例化
14604
14605 为什么不用cpp20的constraints?
14606 1.不能类内定义
14607 2.不能作为模板参数
14608 一句话总结:c艹标准会sb
14609 */
14610 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
14611 /*默认参与模板候选*/
14612 #define enabled_by_default class enable_state=void
14613 /*默认不参与模板候选*/
14614 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
14615 /*若参数为病式,那么此模板不会实例化*/
14616 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
14617 /*用于模板声明*/
14618 #define enable_flag class enable_state
14619
14620 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
14621 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
14622 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
14623 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
14624 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
14625
14626 /*让lambda递归更加美观*/
14627 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
14628 /*让lambda递归更加美观*/
14629 #define get_recursive_lambda_caller(name) \
14630 lambda_with_catch(&)(auto&&...Args){\
14631 return name(name,Args...);\
14632 }
14633 /*让lambda定义更加美观*/
14634 #define lambda []
14635 /*让lambda定义更加美观*/
14636 #define lambda_with_catch(...) [__VA_ARGS__]
14637 /*让lambda递归更加美观*/
14638 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
14639 //recursive_lambda_self_referential_reserved_symbolname
14640 #define lambda_RLSRRS _my_jb_super_sb_name_
14641
14642 #define MAGIC//ahh,ko no tenno da!
14643
14644 /*装饰性语法糖*/
14645 #define nothing
14646
14647 /*aya风格语法糖*/
14648 #define elseif else if
14649 /*aya风格语法糖*/
14650 #define _big_than_ >
14651 /*aya风格语法糖*/
14652 #define _small_than_ <
14653
14654 #if defined(_MSC_VER)
14655 #define not !
14656 #define and &&
14657 #define or ||
14658 #endif
14659
14660 /*进入名称空间,并不是很美观*/
14661 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
14662 /*退出名称空间,并不是很美观*/
14663 #define BREAK_NAMESPACE }
14664
14665 /*template说明符*/
14666 #define template_name template
14667 /*template说明符*/
14668 #define type_name class
14669
14670 #if defined(DEBUG) || defined(_DEBUG)
14671 #define not_in_debug 0
14672 #else
14673 #define not_in_debug 1
14674 #endif
14675
14676 #define es U""
14677 #define ec(ch) U ## ch
14678
14679 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
14680 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
14681 #else
14682 #define ELC_TEST_EVENTNAME(name)
14683 #endif
14684
14685 #define override_instance_struct \
14686 protected:\
14687 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
14688 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
14689 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
14690 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
14691 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
14692
14693 #if defined(_WIN32)
14694 #define distinctive __declspec(dllexport)
14695 #else
14696 #define distinctive
14697 #endif
14698
14699 #if defined(_WIN32)
14700 #define force_inline __forceinline
14701 #elif defined(__GNUC__)
14702 #define force_inline __attribute__((always_inline)) inline
14703 #else
14704 #define force_inline inline
14705 #endif
14706
14707 #if defined(_WIN32)
14708 #define with_no_vtable __declspec(novtable)
14709 #else
14710 #define with_no_vtable
14711 #endif
14712
14713 #define in_consteval (::std::is_constant_evaluated())
14714
14715 #define no_vtable_struct struct with_no_vtable
14716 #define no_vtable_class class with_no_vtable
14717
14718 //file_end
14719
14720 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
14721
14722 //file_end
14723
14724 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
14725
14726 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/defs.hpp"
14727 //defs.hpp
14728 //at namespace elc::defs
14729 /*
14730 未完成的elc解释器string文件
14731 由steve02081504与Alex0125设计、编写
14732 转载时请在不对此文件做任何修改的同时注明出处
14733 项目地址:https://github.com/steve02081504/ELC
14734 */
14735 namespace string_n{
14736 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
14737 //_body.hpp
14738 //at namespace elc::defs::string_n
14739 /*
14740 未完成的elc解释器string文件
14741 由steve02081504与Alex0125设计、编写
14742 转载时请在不对此文件做任何修改的同时注明出处
14743 项目地址:https://github.com/steve02081504/ELC
14744 */
14745 inline namespace string_data_n{
14746 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_decl.hpp"
14747 //_decl.hpp
14748 //at namespace elc::defs::string_n::string_data_n
14749 /*
14750 未完成的elc解释器string文件
14751 由steve02081504与Alex0125设计、编写
14752 转载时请在不对此文件做任何修改的同时注明出处
14753 项目地址:https://github.com/steve02081504/ELC
14754 */
14755 template<typename char_T>
14756 struct base_string_data_t;
14757
14758 template<typename char_T>
14759 struct null_string_data_t;
14760 template<typename char_T>
14761 struct constexpr_string_data_t;
14762
14763 template<typename char_T>
14764 struct comn_string_data_t;
14765
14766 template<typename char_T>
14767 struct substr_string_data_t;
14768
14769 template<typename char_T>
14770 struct head_apply_string_data_t;
14771 template<typename char_T>
14772 struct end_apply_string_data_t;
14773
14774 template<typename char_T>
14775 struct sum_string_data_t;
14776
14777 template<typename char_T>
14778 struct erased_string_data_t;
14779 template<typename char_T>
14780 struct inserted_string_data_t;
14781
14782 //template<typename char_T>
14783 //struct replaced_string_data_t;
14784
14785 template<typename char_T>
14786 struct same_value_compress_string_data_t;
14787
14788 //file_end
14789
14790 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
14791
14792 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/base_string_data_t.hpp"
14793 //base_string_data_t.hpp
14794 //at namespace elc::defs::string_n::string_data_n
14795 /*
14796 未完成的elc解释器string文件
14797 由steve02081504与Alex0125设计、编写
14798 转载时请在不对此文件做任何修改的同时注明出处
14799 项目地址:https://github.com/steve02081504/ELC
14800 */
14801 template<typename char_T>
14803 with_common_attribute<abstract_base,never_in_array,replace_able,ref_able>,build_by_get_only{
14804 typedef base_string_data_t<char_T> this_t;
14805 typedef comn_ptr_t<this_t> ptr_t;
14807
14808 static_assert(noexcept(declvalue(ptr_t).operator*()));//貌似msvc在这里有bug
14809
14810 static constexpr bool copy_assign_nothrow=copy_assign.nothrow<char_T>;
14811 static constexpr bool copy_construct_nothrow=copy_construct.nothrow<char_T>;
14812 static constexpr bool move_construct_nothrow=move_construct.nothrow<char_T>;
14813 static constexpr bool construct_nothrow=construct<char_T>.nothrow<>;
14814 static constexpr bool destruct_nothrow=destruct.nothrow<char_T>;
14815 static constexpr bool clear_nothrow=destruct_nothrow;
14816 static constexpr bool ptr_reset_nothrow=destruct_nothrow;
14817 static constexpr bool hash_nothrow=hash.nothrow<char_T>;
14818 static constexpr bool get_data_nothrow=copy_construct_nothrow&&destruct_nothrow;
14819 static constexpr bool apply_data_nothrow=construct_nothrow&&copy_assign_nothrow;
14820
14821 friend class null_string_data_t<char_T>;
14822 friend class constexpr_string_data_t<char_T>;
14823 friend class comn_string_data_t<char_T>;
14824 friend class substr_string_data_t<char_T>;
14825 friend class head_apply_string_data_t<char_T>;
14826 friend class end_apply_string_data_t<char_T>;
14827 friend class sum_string_data_t<char_T>;
14828 friend class erased_string_data_t<char_T>;
14829 friend class inserted_string_data_t<char_T>;
14830 //friend class replaced_string_data_t<char_T>;
14831 friend class same_value_compress_string_data_t<char_T>;
14832
14833 base_string_data_t()noexcept=default;
14834 base_string_data_t(never_ref_num_zero_t)noexcept{ attribute_ptr_cast<ref_able>(this)->init_never_ref_num_zero(); }
14835
14836 [[nodiscard]]bool is_unique()noexcept{ return get_ref_num(this)==1; }
14837 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)=0;
14838
14839 virtual ~base_string_data_t()noexcept(destruct_nothrow)=default;
14840
14841 [[nodiscard]]virtual char_T* get_c_str(ptr_t&)noexcept(get_data_nothrow);
14842 [[nodiscard]]virtual const char_T* get_const_c_str(ptr_t&p)noexcept(get_data_nothrow){return get_c_str(p);}
14843 [[nodiscard]]virtual const char_T* get_data(ptr_t&p)noexcept(get_data_nothrow){return get_c_str(p);}//不要求以0结尾
14844 [[nodiscard]]virtual char_T* get_unique_c_str(ptr_t&)noexcept(get_data_nothrow);
14845 [[nodiscard]]virtual size_t get_size()noexcept=0;
14846 [[nodiscard]]virtual ptr_t get_substr_data(size_t begin,size_t size)noexcept;
14847 [[nodiscard]]virtual ptr_t apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow);
14848 [[nodiscard]]virtual ptr_t apply_str_to_begin(ptr_t str)noexcept(apply_data_nothrow);
14849 [[nodiscard]]virtual ptr_t apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow);
14850 [[nodiscard]]virtual ptr_t apply_str_to_end(ptr_t str)noexcept(apply_data_nothrow);
14851
14852 [[nodiscard]]virtual ptr_t do_insert(size_t pos,string_view_t str)noexcept(copy_construct_nothrow);
14853 [[nodiscard]]virtual ptr_t do_insert(size_t pos,ptr_t str)noexcept;
14854 [[nodiscard]]virtual ptr_t do_erase(size_t pos,size_t size)noexcept;
14855
14856 [[nodiscard]]virtual ptr_t do_pop_back(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow){
14857 const auto pos = this->get_size()-size;
14858 const auto before = get_substr_data(0,pos);
14859 const auto after = get_substr_data(pos,size);
14860 self = before;
14861 return after;
14862 }
14863 [[nodiscard]]virtual ptr_t do_pop_front(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow){
14864 const auto pos = size;
14865 const auto before = get_substr_data(0,pos);
14866 const auto after = get_substr_data(pos,this->get_size()-size);
14867 self = after;
14868 return before;
14869 }
14870 /*
14871 TODO:
14872
14873 find
14874 rfind
14875 find_first_of
14876 find_first_not_of
14877 find_last_of
14878 find_last_not_of
14879
14880 starts_with
14881 ends_with
14882 contains
14883 replace
14884 */
14885 typedef compare_t::type<char_T> compare_type;
14886 protected:
14887 bool same_type(ptr_t a)noexcept{return typeid(*this)==typeid(*a);}
14888 [[nodiscard]]virtual bool same_struct(ptr_t)noexcept=0;
14889 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)=0;
14890 [[nodiscard]]virtual compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)=0;
14891 protected:
14892 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form(size_t begin)noexcept=0;
14893 public:
14894 [[nodiscard]]bool equal_with(ptr_t with)noexcept(equal.nothrow<char_T>){
14895 //eq->equal优化
14896 if(this==with)
14897 return true;
14898 //hash_diff->not_equal优化
14899 if(this->has_hash_cache()&&with->has_hash_cache())
14900 if(this->get_hash_cache()!=with->get_hash_cache())
14901 return false;
14902 //size比较优化被移至string_t实现内部:原因:same_struct_compare大部分情况下size相同。
14903 //快速比较结束,实际比较段
14904 {
14905 suppress_msvc_warning(26494)//未初始化警告diss
14906 bool aret;
14907 {
14908 //同结构比较优化比较方式
14909 if(same_type(with)&&same_struct(with))
14910 aret=same_struct_equal(with);
14911 //否则默认比较
14912 else
14913 aret=default_equal_method(with);
14914 }
14915 //如果equal,则eq处理
14916 if(aret)
14917 equivalent_optimization(this,with);
14918 return aret;
14919 }
14920 }
14921 protected:
14922 [[nodiscard]]bool default_equal_method(ptr_t with)noexcept(equal.nothrow<char_T>){
14923 const size_t self_size=get_size();
14924 return equal_with(with,0,self_size);
14925 }
14926 public:
14927 [[nodiscard]]bool equal_with(ptr_t with,size_t pos,size_t size)noexcept(equal.nothrow<char_T>){
14928 //eq->equal优化
14929 if(this==with)
14930 return true;
14931 size_t index=pos;
14932 auto a=this->get_the_largest_complete_data_block_begin_form(index);
14933 auto b=with->get_the_largest_complete_data_block_begin_form(index);
14934 while(size){
14935 const size_t step=min({a.size(),b.size(),size});
14936 if(a.begin()!=b.begin())//起始地址不同时才需要真的比较
14937 if(!equal(a.begin(),b.begin(),step))
14938 return false;
14939 index+=step;
14940 size-=step;
14941 if(a.size()==step)
14942 a=this->get_the_largest_complete_data_block_begin_form(index);
14943 else
14944 a={a.begin()+step,note::size(a.size()-step)};
14945 if(b.size()==step)
14946 b=with->get_the_largest_complete_data_block_begin_form(index);
14947 else
14948 b={b.begin()+step,note::size(b.size()-step)};
14949 if(!a.size()&&!b.size())
14950 return a.size()==b.size();
14951 }
14952 return true;
14953 }
14954 [[nodiscard]]bool equal_with(string_view_t with)noexcept(equal.nothrow<char_T>){
14955 size_t size=with.size();
14956 size_t index=0;
14957 auto a=this->get_the_largest_complete_data_block_begin_form(index);
14958 if(a.begin()==with.begin() && a.size()==with.size())
14959 return true;
14960 floop{
14961 auto b=with.begin()+index;
14962 const size_t step=min({a.size(),with.size()-index,size});
14963 if(!equal(a.begin(),b,step))
14964 return false;
14965 index+=step;
14966 size-=step;
14967 if(a.size()==step)
14968 a=this->get_the_largest_complete_data_block_begin_form(index);
14969 else
14970 a={a.begin()+step,note::size(a.size()-step)};
14971 if(!a.size()||!size)
14972 return a.size()==size;
14973 }
14974 }
14975 [[nodiscard]]bool equal_with(const char_T*with)noexcept(equal.nothrow<char_T>){
14976 size_t size=get_size();
14977 size_t index=0;
14978 auto a=this->get_the_largest_complete_data_block_begin_form(index);
14979 if(a.begin()==with && with[a.size()]==char_T{})
14980 return true;
14981 floop{
14982 auto b=with+index;
14983 if(!*b)
14984 return false;
14985 size_t step=min({a.size(),size});
14986 if(!equal(a.begin(),step,just_an_part,b,end_by_zero))
14987 return false;
14988 index+=step;
14989 size-=step;
14990 if(a.size()==step)
14991 a=this->get_the_largest_complete_data_block_begin_form(index);
14992 else
14993 a={a.begin()+step,note::size(a.size()-step)};
14994 if(!*(b+step))
14995 return !a.size();
14996 if(!a.size())
14997 return !*(b+step);
14998 }
14999 }
15000 public:
15001 [[nodiscard]]compare_type compare_with(ptr_t with)noexcept(compare.nothrow<char_T>){
15002 //eq->equal优化
15003 if(this==with)
15004 return strong_ordering::equivalent;
15005 //size比较优化被移至string_t实现内部:原因:same_struct_compare大部分情况下size相同。
15006 //快速比较结束,实际比较段
15007 {
15008 suppress_msvc_warning(26494)//未初始化警告diss
15009 compare_type aret;
15010 {
15011 //同结构比较优化比较方式
15012 if(same_type(with)&&same_struct(with))
15013 aret=same_struct_compare(with);
15014 //否则默认比较
15015 else
15016 aret=default_compare_method(with);
15017 }
15018 //如果equal,则eq处理
15019 if(aret==0)
15020 equivalent_optimization(this,with);
15021 return aret;
15022 }
15023 }
15024 protected:
15025 [[nodiscard]]compare_type default_compare_method(ptr_t with)noexcept(compare.nothrow<char_T>){
15026 const size_t self_size=get_size();
15027 return compare_with(with,0,self_size);
15028 }
15029 public:
15030 [[nodiscard]]compare_type compare_with(ptr_t with,size_t pos,size_t size)noexcept(compare.nothrow<char_T>){
15031 //eq->equal优化
15032 if(this==with)
15033 return strong_ordering::equivalent;
15034 size_t index=pos;
15035 auto a=this->get_the_largest_complete_data_block_begin_form(index);
15036 auto b=with->get_the_largest_complete_data_block_begin_form(index);
15037 while(size){
15038 const size_t step=min({a.size(),b.size(),size});
15039 if(a.begin()!=b.begin())//起始地址不同时才需要真的比较
15040 if(auto tmp=compare(a.begin(),b.begin(),step); tmp!=0)
15041 return tmp;
15042 index+=step;
15043 size-=step;
15044 if(a.size()==step)
15045 a=this->get_the_largest_complete_data_block_begin_form(index);
15046 else
15047 a={a.begin()+step,note::size(a.size()-step)};
15048 if(b.size()==step)
15049 b=with->get_the_largest_complete_data_block_begin_form(index);
15050 else
15051 b={b.begin()+step,note::size(b.size()-step)};
15052 if(!a.size()||!b.size())
15053 return a.size()<=>b.size();
15054 }
15055 return strong_ordering::equivalent;
15056 }
15057 [[nodiscard]]compare_type compare_with(string_view_t with)noexcept(compare.nothrow<char_T>){
15058 size_t size=with.size();
15059 size_t index=0;
15060 auto a=this->get_the_largest_complete_data_block_begin_form(index);
15061 if(a.begin()==with.begin() && a.size()==with.size())
15062 return strong_ordering::equivalent;
15063 floop{
15064 auto b=with.begin()+index;
15065 size_t step=min({a.size(),with.size()-index,size});
15066 if(auto tmp=compare(a.begin(),b,step); tmp!=0)
15067 return tmp;
15068 index+=step;
15069 size-=step;
15070 if(a.size()==step)
15071 a=this->get_the_largest_complete_data_block_begin_form(index);
15072 else
15073 a={a.begin()+step,note::size(a.size()-step)};
15074 if(!a.size()||!size)
15075 return a.size()<=>size;
15076 }
15077 }
15078 [[nodiscard]]compare_type compare_with(const char_T*with)noexcept(compare.nothrow<char_T>){
15079 size_t size=get_size();
15080 size_t index=0;
15081 auto a=this->get_the_largest_complete_data_block_begin_form(index);
15082 if(a.begin()==with && with[a.size()]==char_T{})
15083 return strong_ordering::equivalent;
15084 floop{
15085 auto b=with+index;
15086 if(!*b)
15087 return strong_ordering::greater;
15088 size_t step=min({a.size(),size});
15089 if(auto tmp=compare(a.begin(),step,just_an_part,b,end_by_zero); tmp!=0)
15090 return tmp;
15091 index+=step;
15092 size-=step;
15093 if(a.size()==step)
15094 a=this->get_the_largest_complete_data_block_begin_form(index);
15095 else
15096 a={a.begin()+step,note::size(a.size()-step)};
15097 if(!a.size())
15098 return *(with+index)==char_T{}? strong_ordering::equivalent:
15099 strong_ordering::less;
15100 if(!*(with+index))
15101 return strong_ordering::greater;
15102 }
15103 }
15104 protected:
15105 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)=0;
15106 public:
15107 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)=0;
15108 virtual void arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow)=0;
15109 protected:
15110 hash_t _hash_cache{};
15111 bool _has_hash_cache=false;
15112 bool has_hash_cache()noexcept{return _has_hash_cache;}
15113 void reset_hash_cache()noexcept{_has_hash_cache=false;}
15114 hash_t get_hash_cache()noexcept{return _hash_cache;}
15115 hash_t set_hash_cache(hash_t value)noexcept{_has_hash_cache=true;return _hash_cache=value;}
15116 public:
15117 hash_t get_hash(ptr_t&p)noexcept(hash_nothrow){
15118 if(has_hash_cache())
15119 return get_hash_cache();
15120 else{
15121 const auto tmp=this->get_hash_detail(p);
15122 return p->set_hash_cache(tmp);
15123 }
15124 }
15125 protected:
15126 virtual hash_t get_hash_detail(ptr_t&p)noexcept(hash_nothrow){
15127 const auto size=get_size();
15128 const auto data=get_data(p);
15129 return hash(data,size);
15130 }
15131 public:
15132 hash_t get_others_hash_with_calculated_before(hash_t before,size_t before_size,ptr_t&p,size_t pos,size_t size)noexcept(hash_nothrow){
15133 if(pos==0&&size==get_size())
15134 return hash.merge_array_hash_results(before,before_size,get_hash(p),size);
15135 return this->get_others_hash_with_calculated_before_detail(before,before_size,p,pos,size);
15136 }
15137 protected:
15138 virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before,size_t before_size,ptr_t&p,size_t pos,size_t size)noexcept(hash_nothrow){
15139 return hash.with_calculated_before(before,before_size,get_data(p)+pos,size);
15140 }
15141 protected:
15142 void self_changed()noexcept{
15143 reset_hash_cache();
15144 }
15145 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept=0;
15146 public:
15147 [[nodiscard]]float_size_t get_memory_cost()noexcept{
15148 return get_base_memory_cost()/get_ref_num(this);
15149 }
15150 [[nodiscard]]float_size_t get_memory_cost_after_gc()noexcept;
15151 [[nodiscard]]float_size_t get_gc_profit()noexcept{return get_memory_cost()-get_memory_cost_after_gc();}
15152 [[nodiscard]]bool positive_gc_profit()noexcept{return get_gc_profit() > 0;}
15153 //for gc:
15154 /*
15155 [[nodiscard]]virtual bool gc()=0{
15156 bool need_be_replace=get_gc_profit()>=0
15157 if(need_be_replace)
15158 this->be_replace_as(get<comn_string_data_t>(this));
15159 return need_be_replace;
15160 }
15161 */
15162
15163 [[nodiscard]]virtual const range_n::match_pattern<const char_T>& get_match_pattern_from_self(ptr_t&self)noexcept(copy_assign_nothrow&&move_construct_nothrow);
15164 [[nodiscard]]virtual const range_n::reverse_match_pattern<const char_T>& get_reverse_match_pattern_from_self(ptr_t&self)noexcept(copy_assign_nothrow&&move_construct_nothrow);
15165
15166 protected:
15167 static inline void be_replace(this_t* a,ptr_t b)noexcept(ptr_reset_nothrow){
15168 a->be_replace_as(b);
15169 }
15170 static inline void be_replace(ptr_t& a,ptr_t b)noexcept(ptr_reset_nothrow){
15171 a.do_replace(b);
15172 }
15173 static inline void equivalent_optimization(auto&& a,auto&& b)noexcept(ptr_reset_nothrow){
15174 if(a->get_memory_cost() >= b->get_memory_cost())
15175 be_replace(a,b);
15176 else
15177 be_replace(b,a);
15178 }
15179 };
15180 template<typename char_T>
15181 void base_string_data_t<char_T>::be_replace_as(ptr_t a)noexcept(clear_nothrow){
15183 }
15184
15185 //file_end
15186
15187 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
15188
15189 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/null_string_data_t.hpp"
15190 //null_string_data_t.hpp
15191 //at namespace elc::defs::string_n::string_data_n
15192 /*
15193 未完成的elc解释器string文件
15194 由steve02081504与Alex0125设计、编写
15195 转载时请在不对此文件做任何修改的同时注明出处
15196 项目地址:https://github.com/steve02081504/ELC
15197 */
15198 template<typename char_T>
15199 struct null_string_data_t final:base_string_data_t<char_T>,instance_struct<null_string_data_t<char_T>>{
15201 typedef base_string_data_t<char_T> base_t;
15202 using base_t::ptr_t;
15203 using base_t::string_view_t;
15204
15205 using base_t::copy_assign_nothrow;
15206 using base_t::copy_construct_nothrow;
15207 using base_t::move_construct_nothrow;
15208 using base_t::construct_nothrow;
15209 using base_t::destruct_nothrow;
15210 using base_t::clear_nothrow;
15211 using base_t::ptr_reset_nothrow;
15212 using base_t::hash_nothrow;
15213 using base_t::get_data_nothrow;
15214 using base_t::apply_data_nothrow;
15215 using base_t::set_hash_cache;
15216
15217 null_string_data_t()noexcept:base_t(never_ref_num_zero){}
15218
15219 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{nothing;}
15220 [[nodiscard]]virtual char_T* get_c_str(ptr_t&)noexcept override final{
15221 static char_T data[1]{};
15222 return data;
15223 }
15224 [[nodiscard]]virtual size_t get_size()noexcept override final{ return 0; }
15225 [[nodiscard]]virtual ptr_t get_substr_data([[maybe_unused]]size_t begin,[[maybe_unused]]size_t size)noexcept override final{ return this; }
15226 [[nodiscard]]virtual ptr_t apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{ return get<comn_string_data_t<char_T>>(str); }
15227 [[nodiscard]]virtual ptr_t apply_str_to_begin(ptr_t str)noexcept(apply_data_nothrow)override final{ return str; }
15228 [[nodiscard]]virtual ptr_t apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{ return get<comn_string_data_t<char_T>>(str); }
15229 [[nodiscard]]virtual ptr_t apply_str_to_end(ptr_t str)noexcept override final{ return str; }
15230
15231 [[nodiscard]]virtual ptr_t do_insert([[maybe_unused]]size_t pos,[[maybe_unused]]string_view_t str)noexcept(construct_nothrow&&copy_assign_nothrow)override final{ return get<comn_string_data_t<char_T>>(str); }
15232 [[nodiscard]]virtual ptr_t do_insert([[maybe_unused]]size_t pos,[[maybe_unused]]ptr_t str)noexcept override final{ return str; }
15233 [[nodiscard]]virtual ptr_t do_erase([[maybe_unused]]size_t pos,[[maybe_unused]]size_t size)noexcept override final{ return this; }
15234 protected:
15235 virtual void copy_part_data_to([[maybe_unused]]char_T* to,[[maybe_unused]]size_t pos,[[maybe_unused]]size_t size)noexcept override final{ return; }
15236 public:
15237 [[nodiscard]]virtual char_T arec([[maybe_unused]]size_t index)noexcept override final{ return char_T{}; }
15238 virtual void arec_set([[maybe_unused]]size_t index,[[maybe_unused]]char_T a,[[maybe_unused]]ptr_t& p)noexcept override final{ nothing; }
15239 [[nodiscard]]virtual ptr_t do_pop_back([[maybe_unused]]size_t size,[[maybe_unused]]ptr_t& self)noexcept override final{ return this; }
15240 [[nodiscard]]virtual ptr_t do_pop_front([[maybe_unused]]size_t size,[[maybe_unused]]ptr_t& self)noexcept override final{ return this; }
15241 protected:
15242 virtual hash_t get_hash_detail([[maybe_unused]]ptr_t&p)noexcept override final{ return hash(nothing); }
15243 virtual hash_t get_others_hash_with_calculated_before_detail([[maybe_unused]]hash_t before,[[maybe_unused]]size_t before_size,[[maybe_unused]]ptr_t&p,[[maybe_unused]]size_t pos,[[maybe_unused]]size_t size)noexcept override final{ return before; }
15244 protected:
15245 [[nodiscard]]virtual bool same_struct(ptr_t)noexcept override final{return false;}
15246 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form([[maybe_unused]]size_t begin)noexcept override final{return {0,0};}
15247 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept override final{return false;}
15248 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept override final{return strong_ordering::equivalent;}
15249 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{return 0;}
15250 };
15251 template<typename char_T>
15252 distinctive inline null_string_data_t<char_T> null_string_data{};
15253 template<typename char_T>
15254 base_string_data_t<char_T>* the_get_null_ptr(const base_string_data_t<char_T>*)noexcept{ return&null_string_data<char_T>; }
15255
15256 //file_end
15257
15258 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
15259 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/constexpr_string_data_t.hpp"
15260 //constexpr_string_data_t.hpp
15261 //at namespace elc::defs::string_n::string_data_n
15262 /*
15263 未完成的elc解释器string文件
15264 由steve02081504与Alex0125设计、编写
15265 转载时请在不对此文件做任何修改的同时注明出处
15266 项目地址:https://github.com/steve02081504/ELC
15267 */
15268 template<typename char_T>
15269 struct constexpr_string_data_t final:base_string_data_t<char_T>,instance_struct<constexpr_string_data_t<char_T>>{
15271 typedef base_string_data_t<char_T> base_t;
15272 using base_t::ptr_t;
15273 using base_t::string_view_t;
15274
15275 using base_t::copy_assign_nothrow;
15276 using base_t::copy_construct_nothrow;
15277 using base_t::move_construct_nothrow;
15278 using base_t::construct_nothrow;
15279 using base_t::destruct_nothrow;
15280 using base_t::clear_nothrow;
15281 using base_t::ptr_reset_nothrow;
15282 using base_t::hash_nothrow;
15283 using base_t::get_data_nothrow;
15284 using base_t::apply_data_nothrow;
15285 using base_t::set_hash_cache;
15286
15287 const char_T* _m;
15288 size_t _size;
15289
15290 const range_n::match_pattern<const char_T>* _p_match_pattern = nullptr;
15291 const range_n::reverse_match_pattern<const char_T>* _p_reverse_match_pattern = nullptr;
15292 bool match_pattern_by_get = 0;
15293
15294 void clear_match_pattern()noexcept{
15295 if(match_pattern_by_get){
15296 unget(remove_const(_p_match_pattern));
15297 unget(remove_const(_p_reverse_match_pattern));
15298 _p_match_pattern = nullptr;
15299 _p_reverse_match_pattern = nullptr;
15300 }
15301 }
15302
15304 _m=str.begin();
15305 _size=str.size();
15306 set_hash_cache(hash(str));
15307 _p_match_pattern=&str.match_pattern;
15308 _p_reverse_match_pattern=&str.reverse_match_pattern;
15309 match_pattern_by_get=0;
15310 }
15311 constexpr_string_data_t(string_view_t str)noexcept{
15312 _m=str.begin();
15313 _size=str.size();
15314 if(!_size)
15315 be_replace_as(null_ptr);
15316 }
15317 virtual ~constexpr_string_data_t()noexcept(destruct_nothrow)override final{
15318 clear_match_pattern();
15319 }
15320
15321 [[nodiscard]]virtual ptr_t get_substr_data(size_t begin,size_t size)noexcept override final{
15322 return get<this_t>(string_view_t{_m+begin,size});
15323 }
15324 [[nodiscard]]virtual const char_T* get_data(ptr_t&)noexcept(get_data_nothrow)override final{return _m;}
15325 [[nodiscard]]virtual const char_T* get_const_c_str(ptr_t&p)noexcept(get_data_nothrow)override final{
15326 if(!_m[_size])
15327 return _m;
15328 else
15329 return base_t::get_const_c_str(p);
15330 }
15331 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _size; }
15332 protected:
15333 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{ copy_assign[size](note::from(_m+pos),note::to(to)); }
15334 public:
15335 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{ return _m[index]; }
15336
15337 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{base_t::be_replace_as(a);}
15338 virtual void arec_set(size_t index,char_T a,ptr_t&p)noexcept override final{base_t::arec_set(index,a,p);}
15339
15340 [[nodiscard]]virtual bool same_struct(ptr_t with)noexcept override final{
15341 return true;//总size被保证一样
15342 }
15343 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form(size_t begin)noexcept override final{return {&_m[begin],note::size(_size-begin)};}
15344 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
15345 auto wp=down_cast<this_t*>(with.get());
15346 if(_m==wp->_m)
15347 return true;
15348 return equal(_m,wp->_m,_size);
15349 }
15350 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
15351 auto wp=down_cast<this_t*>(with.get());
15352 if(_m==wp->_m)
15353 return strong_ordering::equivalent;
15354 return compare(_m,wp->_m,_size);
15355 }
15356 protected:
15357 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
15358 return float_size_of(*this);
15359 }
15360 public:
15361 [[nodiscard]]virtual const range_n::match_pattern<const char_T>& get_match_pattern_from_self(ptr_t&self)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
15362 if(!_p_match_pattern){
15363 _p_match_pattern=get<range_n::match_pattern<const char_T>>(array_like_view_t{this->get_data(self),this->get_size()});
15364 match_pattern_by_get = 1;
15365 }
15366 return *_p_match_pattern;
15367 }
15368 [[nodiscard]]virtual const range_n::reverse_match_pattern<const char_T>&get_reverse_match_pattern_from_self(ptr_t&self)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
15369 if(!_p_reverse_match_pattern){
15370 _p_reverse_match_pattern=get<range_n::reverse_match_pattern<const char_T>>(array_like_view_t{this->get_data(self),this->get_size()});
15371 match_pattern_by_get = 1;
15372 }
15373 return *_p_reverse_match_pattern;
15374 }
15375 };
15376
15377 //file_end
15378
15379 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
15380
15381 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/comn_string_data_t.hpp"
15382 //comn_string_data_t.hpp
15383 //at namespace elc::defs::string_n::string_data_n
15384 /*
15385 未完成的elc解释器string文件
15386 由steve02081504与Alex0125设计、编写
15387 转载时请在不对此文件做任何修改的同时注明出处
15388 项目地址:https://github.com/steve02081504/ELC
15389 */
15390 template<typename char_T>
15391 struct comn_string_data_t final:base_string_data_t<char_T>,instance_struct<comn_string_data_t<char_T>>{
15393 typedef base_string_data_t<char_T> base_t;
15394 using base_t::ptr_t;
15395 using base_t::string_view_t;
15396 using base_t::self_changed;
15397
15398 using base_t::copy_assign_nothrow;
15399 using base_t::copy_construct_nothrow;
15400 using base_t::move_construct_nothrow;
15401 using base_t::construct_nothrow;
15402 using base_t::destruct_nothrow;
15403 using base_t::clear_nothrow;
15404 using base_t::ptr_reset_nothrow;
15405 using base_t::hash_nothrow;
15406 using base_t::get_data_nothrow;
15407 using base_t::apply_data_nothrow;
15408 using base_t::set_hash_cache;
15409
15410 array_t<char_T> _m;
15411 range_n::match_pattern<const char_T>* _p_match_pattern = nullptr;
15412 range_n::reverse_match_pattern<const char_T>* _p_reverse_match_pattern = nullptr;
15413 void clear_match_pattern()noexcept{
15414 unget(_p_match_pattern);
15415 unget(_p_reverse_match_pattern);
15416 base_t::self_changed();
15417 }
15418 void self_changed()noexcept{
15419 clear_match_pattern();
15420 base_t::self_changed();
15421 }
15422
15423 comn_string_data_t(string_view_t str)noexcept(construct_nothrow&&copy_assign_nothrow):_m(note::size(str.size()+1)){
15424 copy_assign[str.size()](note::from(str.begin()),note::to((char_T*)_m));
15425 _m[str.size()]=zero;
15426 }
15427 comn_string_data_t(ptr_t str)noexcept(construct_nothrow&&copy_assign_nothrow):_m(note::size(str->get_size()+1)){
15428 auto size=this->get_size();
15429 str->copy_part_data_to((char_T*)_m,0,size);
15430 _m[size]=zero;
15431 }
15432 comn_string_data_t(ptr_t str,size_t pos,size_t size)noexcept(construct_nothrow&&copy_assign_nothrow):_m(note::size(size+1)){
15433 str->copy_part_data_to((char_T*)_m,pos,size);
15434 _m[size]=zero;
15435 }
15436 comn_string_data_t(size_t size,char_T ch)noexcept(construct_nothrow&&copy_assign_nothrow):_m(note::size(size+1),ch){
15437 _m[size]=zero;
15438 }
15439 comn_string_data_t(size_t size)noexcept(construct_nothrow&&copy_assign_nothrow):_m(note::size(size+1)){
15440 _m[size]=zero;
15441 }
15442
15443 virtual ~comn_string_data_t()noexcept(destruct_nothrow)override final{
15444 clear_match_pattern();
15445 }
15446
15447 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{
15448 _m.clear();
15449 base_t::be_replace_as(a);
15450 }
15451 [[nodiscard]]virtual char_T* get_c_str(ptr_t&)noexcept override final{ return (char_T*)_m; }
15452 [[nodiscard]]virtual char_T* get_unique_c_str(ptr_t&p)noexcept(get_data_nothrow)override final{
15453 if(this->is_unique())
15454 return (char_T*)_m;
15455 else
15456 return base_t::get_unique_c_str(p);
15457 }
15458 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _m.size()-1; }
15459 protected:
15460 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{ copy_assign[size](note::from((const char_T*)_m+pos),note::to(to)); }
15461 public:
15462 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{ return _m[index]; }
15463 virtual void arec_set(size_t index,char_T a,ptr_t&p)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
15464 if(this->is_unique()){
15465 copy_assign(_m[index],a);
15466 self_changed();
15467 }
15468 else
15469 base_t::arec_set(index,a,p);
15470 }
15471
15472 [[nodiscard]]virtual bool same_struct(ptr_t)noexcept override final{
15473 return true;//总size被保证一样
15474 }
15475 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form(size_t begin)noexcept override final{return {&_m[begin],note::size(get_size()-begin)};}
15476 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
15477 auto wp=down_cast<this_t*>(with.get());
15478 return equal(_m, wp->_m);
15479 }
15480 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
15481 auto wp=down_cast<this_t*>(with.get());
15482 return compare(_m, wp->_m);
15483 }
15484 protected:
15485 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
15486 return float_size_of(*this) + _m.size_in_byte();
15487 }
15488 public:
15489 [[nodiscard]]virtual const range_n::match_pattern<const char_T>& get_match_pattern_from_self(ptr_t&self)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
15490 if(!_p_match_pattern){
15491 _p_match_pattern=get<range_n::match_pattern<const char_T>>(array_like_view_t{this->get_data(self),this->get_size()});
15492 }
15493 return *_p_match_pattern;
15494 }
15495 [[nodiscard]]virtual const range_n::reverse_match_pattern<const char_T>&get_reverse_match_pattern_from_self(ptr_t&self)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
15496 if(!_p_reverse_match_pattern){
15497 _p_reverse_match_pattern=get<range_n::reverse_match_pattern<const char_T>>(array_like_view_t{this->get_data(self),this->get_size()});
15498 }
15499 return *_p_reverse_match_pattern;
15500 }
15501 };
15502 template<typename char_T>
15503 [[nodiscard]]char_T* base_string_data_t<char_T>::get_c_str(ptr_t&a)noexcept(get_data_nothrow){
15504 auto comn_data=get<comn_string_data_t<char_T>>(this);
15505 if(positive_gc_profit())
15506 a.do_replace(comn_data);
15507 else
15508 a=comn_data;
15509 return comn_data->get_c_str(a);
15510 }
15511 template<typename char_T>
15512 [[nodiscard]]char_T* base_string_data_t<char_T>::get_unique_c_str(ptr_t&a)noexcept(get_data_nothrow){
15513 auto comn_data=get<comn_string_data_t<char_T>>(this);
15514 a=comn_data;
15515 return comn_data->get_c_str(a);
15516 }
15517 template<typename char_T>
15518 void base_string_data_t<char_T>::arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow){
15519 copy_assign(this->get_unique_c_str(p)[index],a);
15520 }
15521 template<typename char_T>
15522 [[nodiscard]]float_size_t base_string_data_t<char_T>::get_memory_cost_after_gc()noexcept{
15523 const auto size_of_base_array=this->get_size()*sizeof(char_T);
15524 const auto size=float_size_of(comn_string_data_t<char_T>)+size_of_base_array;
15525 return size/get_ref_num(this);
15526 }
15527 template<typename char_T>
15528 [[nodiscard]]const range_n::match_pattern<const char_T>& base_string_data_t<char_T>::get_match_pattern_from_self(ptr_t&self)noexcept(copy_assign_nothrow&&move_construct_nothrow){
15529 auto comn_data=get<comn_string_data_t<char_T>>(this);
15530 self=comn_data;
15531 return comn_data->get_match_pattern_from_self(self);
15532 }
15533 template<typename char_T>
15534 [[nodiscard]]const range_n::reverse_match_pattern<const char_T>& base_string_data_t<char_T>::get_reverse_match_pattern_from_self(ptr_t&self)noexcept(copy_assign_nothrow&&move_construct_nothrow){
15535 auto comn_data=get<comn_string_data_t<char_T>>(this);
15536 self=comn_data;
15537 return comn_data->get_reverse_match_pattern_from_self(self);
15538 }
15539
15540 //file_end
15541
15542 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
15543
15544 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/substr_string_data_t.hpp"
15545 //substr_string_data_t.hpp
15546 //at namespace elc::defs::string_n::string_data_n
15547 /*
15548 未完成的elc解释器string文件
15549 由steve02081504与Alex0125设计、编写
15550 转载时请在不对此文件做任何修改的同时注明出处
15551 项目地址:https://github.com/steve02081504/ELC
15552 */
15553 template<typename char_T>
15554 struct substr_string_data_t final:base_string_data_t<char_T>,instance_struct<substr_string_data_t<char_T>>{
15557 using base_t::ptr_t;
15558 using base_t::string_view_t;
15559 using base_t::self_changed;
15560
15561 using base_t::copy_assign_nothrow;
15562 using base_t::copy_construct_nothrow;
15563 using base_t::move_construct_nothrow;
15564 using base_t::construct_nothrow;
15565 using base_t::destruct_nothrow;
15566 using base_t::clear_nothrow;
15567 using base_t::ptr_reset_nothrow;
15568 using base_t::hash_nothrow;
15569 using base_t::get_data_nothrow;
15570 using base_t::apply_data_nothrow;
15571 using base_t::set_hash_cache;
15572
15573 ptr_t _to;
15574 size_t _sub_begin;
15575 size_t _sub_size;
15576
15577 void null_equivalent_check()noexcept{
15578 if(!_sub_size)
15579 be_replace_as(null_ptr);
15580 }
15581
15582 substr_string_data_t(ptr_t str,size_t sub_begin,size_t sub_size)noexcept:_to(str),_sub_begin(sub_begin),_sub_size(sub_size){
15583 null_equivalent_check();
15584 }
15585
15586 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{
15587 _to.reset();
15588 base_t::be_replace_as(a);
15589 }
15590 [[nodiscard]]virtual ptr_t get_substr_data(size_t begin,size_t size)noexcept override final{ return get<substr_string_data_t<char_T>>(_to,begin+_sub_begin,size); }
15591 [[nodiscard]]virtual const char_T* get_const_c_str(ptr_t&p)noexcept(get_data_nothrow)override final{
15592 if(_sub_begin+_sub_size==_to->get_size())
15593 return _to->get_const_c_str(_to)+_sub_begin;
15594 else
15595 return base_t::get_const_c_str(p);
15596 }
15597 [[nodiscard]]virtual const char_T* get_data(ptr_t&)noexcept(get_data_nothrow)override final{ return _to->get_data(_to)+_sub_begin; }
15598 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _sub_size; }
15599 protected:
15600 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{ _to->copy_part_data_to(to,pos+_sub_begin,size); }
15601 public:
15602 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{ return _to->arec(index+_sub_begin); }
15603 virtual void arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
15604 if(this->is_unique()){
15605 _to->arec_set(index+_sub_begin,a,_to);
15606 self_changed();
15607 }
15608 else
15609 base_t::arec_set(index,a,p);
15610 }
15611 [[nodiscard]]virtual ptr_t apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
15612 if(this->is_unique() && _sub_begin==0){
15613 _to=_to->apply_str_to_begin(str);
15614 _sub_size+=str.size();
15615 self_changed();
15616 return this;
15617 }
15618 else
15619 return base_t::apply_str_to_begin(str);
15620 }
15621 [[nodiscard]]virtual ptr_t apply_str_to_begin(ptr_t str)noexcept(apply_data_nothrow)override final{
15622 if(this->is_unique() && _sub_begin==0){
15623 _to=_to->apply_str_to_begin(str);
15624 _sub_size+=str->get_size();
15625 self_changed();
15626 return this;
15627 }
15628 else
15629 return base_t::apply_str_to_begin(str);
15630 }
15631 [[nodiscard]]virtual ptr_t apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
15632 if(this->is_unique() && _sub_begin+_sub_size==_to->get_size()){
15633 _to=_to->apply_str_to_end(str);
15634 _sub_size+=str.size();
15635 self_changed();
15636 return this;
15637 }
15638 else
15639 return base_t::apply_str_to_end(str);
15640 }
15641 [[nodiscard]]virtual ptr_t apply_str_to_end(ptr_t str)noexcept(apply_data_nothrow)override final{
15642 if(this->is_unique() && _sub_begin+_sub_size==_to->get_size()){
15643 _to=_to->apply_str_to_end(str);
15644 _sub_size+=str->get_size();
15645 self_changed();
15646 return this;
15647 }
15648 else
15649 return base_t::apply_str_to_end(str);
15650 }
15651 [[nodiscard]]virtual ptr_t do_pop_front(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
15652 if(this->is_unique() && _sub_begin==0){
15653 auto aret=_to->do_pop_front(size,_to);
15654 _sub_size-=size;
15655 null_equivalent_check();
15656 self_changed();
15657 return aret;
15658 }
15659 else
15660 return base_t::do_pop_front(size,self);
15661 }
15662 [[nodiscard]]virtual ptr_t do_pop_back(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
15663 if(this->is_unique() && _sub_begin+_sub_size==_to->get_size()){
15664 auto aret=_to->do_pop_back(size,_to);
15665 _sub_size-=size;
15666 null_equivalent_check();
15667 self_changed();
15668 return aret;
15669 }
15670 else
15671 return base_t::do_pop_back(size,self);
15672 }
15673 protected:
15674 virtual hash_t get_hash_detail(ptr_t&)noexcept(hash_nothrow)override final{
15675 auto result=hash(nothing);
15676 result=_to->get_others_hash_with_calculated_before(result,0,_to,_sub_begin,_sub_size);
15677 return result;
15678 }
15679 virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before,size_t before_size,ptr_t&,size_t pos,size_t size)noexcept(hash_nothrow)override final{
15680 return _to->get_others_hash_with_calculated_before(before,before_size,_to,pos+_sub_begin,size);
15681 }
15682 protected:
15683 [[nodiscard]]virtual bool same_struct(ptr_t with)noexcept override final{
15684 auto wp = down_cast<this_t*>(with.get());
15685 return _sub_begin == wp->_sub_begin;//总size被保证一样
15686 }
15687 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form(size_t begin)noexcept override final{
15688 auto result = _to->get_the_largest_complete_data_block_begin_form(_sub_begin+begin);
15689 auto size = min(result.size(),_sub_size-begin);
15690 return {result.begin(), note::size(size)};
15691 }
15692 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
15693 auto wp=down_cast<this_t*>(with.get());
15694 return _to->equal_with(wp->_to,_sub_begin,_sub_size);
15695 }
15696 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
15697 auto wp=down_cast<this_t*>(with.get());
15698 return _to->compare_with(wp->_to,_sub_begin,_sub_size);
15699 }
15700 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
15701 return float_size_of(*this)+_to->get_memory_cost();
15702 }
15703 };
15704 template<typename char_T>
15705 [[nodiscard]]base_string_data_t<char_T>::ptr_t base_string_data_t<char_T>::get_substr_data(size_t begin,size_t size)noexcept{
15706 if(begin==0&&size==get_size())
15707 return this;
15708 else
15709 return get<substr_string_data_t<char_T>>(this,begin,size);
15710 }
15711
15712 //file_end
15713
15714 #line 19 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
15715
15716 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/head_apply_string_data_t.hpp"
15717 //end_apply_string_data_t.hpp
15718 //at namespace elc::defs::string_n::string_data_n
15719 /*
15720 未完成的elc解释器string文件
15721 由steve02081504与Alex0125设计、编写
15722 转载时请在不对此文件做任何修改的同时注明出处
15723 项目地址:https://github.com/steve02081504/ELC
15724 */
15725 template<typename char_T>
15726 struct head_apply_string_data_t final:base_string_data_t<char_T>,instance_struct<head_apply_string_data_t<char_T>>{
15728 typedef base_string_data_t<char_T> base_t;
15729 using base_t::ptr_t;
15730 using base_t::string_view_t;
15731 using base_t::self_changed;
15732
15733 using base_t::copy_assign_nothrow;
15734 using base_t::copy_construct_nothrow;
15735 using base_t::move_construct_nothrow;
15736 using base_t::construct_nothrow;
15737 using base_t::destruct_nothrow;
15738 using base_t::clear_nothrow;
15739 using base_t::ptr_reset_nothrow;
15740 using base_t::hash_nothrow;
15741 using base_t::get_data_nothrow;
15742 using base_t::apply_data_nothrow;
15743 using base_t::set_hash_cache;
15744
15745 array_t<char_T> _m;//意义为向前延续的数组:当需要向前附加内容时向前拓展以避免重新分配内存
15746 ptr_t _to;
15747 size_t _to_size;
15748 size_t _used_size;
15749
15750 head_apply_string_data_t(ptr_t str,string_view_t head)noexcept(construct_nothrow&&copy_assign_nothrow):
15751 _to_size(str->get_size()),
15752 _used_size(head.size()),
15753 _to(str)
15754 {
15755 _m.resize(get_next_gold_size_to_resize_for_array(_to_size+_used_size));
15756 copy_assign[_used_size](note::from<const char_T*>(head.begin()),note::to<char_T*>(_m.end()-_used_size));
15757 }
15758
15759 [[nodiscard]]virtual ptr_t get_substr_data(size_t begin,size_t size)noexcept override final{
15760 if(begin>=_used_size)
15761 return _to->get_substr_data(begin-_used_size,size);
15762 else
15763 return base_t::get_substr_data(begin,size);
15764 }
15765 [[nodiscard]]virtual char_T* get_c_str(ptr_t&p)noexcept(get_data_nothrow)override final{
15766 if(!_used_size)
15767 return _to->get_c_str(_to);
15768 else
15769 return base_t::get_c_str(p);
15770 }
15771 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{
15772 if(type_info<this_t> == typeid(*a)){
15773 const auto p = down_cast<this_t*>(a.get());
15774 if(_used_size==p->_used_size && _to!=p->_to)
15775 base_t::equivalent_optimization(_to, p->_to);
15776 }
15777 _m.clear();
15778 _to.reset();
15779 base_t::be_replace_as(a);
15780 }
15781 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _used_size+_to_size; }
15782 [[nodiscard]]virtual ptr_t do_insert(size_t pos,string_view_t str)noexcept(copy_construct_nothrow)override final{
15783 if(pos==0)
15784 return this->apply_str_to_begin(str);
15785 elseif(pos==get_size())
15786 return this->apply_str_to_end(str);
15787 elseif(this->is_unique()){
15788 if(pos<_used_size){
15789 if(_m.size()-_used_size<str.size()){
15790 const auto size_now=this->get_size()+str.size();
15791 const auto size_new=get_next_gold_size_to_resize_for_array(size_now);
15792 _m.insert_with_forward_resize(pos,str.size(),str.begin(),size_new);
15793 }
15794 else{
15795 char_T* orogin_head_begin=_m.end()-_used_size;
15796 char_T* head_begin=orogin_head_begin-str.size();
15797 copy_assign[pos](note::from<const char_T*>(orogin_head_begin),note::to<char_T*>(head_begin));
15798 copy_assign[str.size()](note::from<const char_T*>(str.begin()),note::to<char_T*>(head_begin+pos));
15799 }
15800 _used_size+=str.size();
15801 self_changed();
15802 return this;
15803 }else
15804 return _to->do_insert(pos-_used_size,str);
15805 }
15806 else
15807 return base_t::do_insert(pos,str);
15808 }
15809 protected:
15810 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{
15811 if(pos<_used_size){
15812 const char_T* head_begin=_m.end()-_used_size;
15813 const char_T* head_end=_m.end();
15814 const char_T* copy_begin=pos+head_begin;
15815 size_t size_of_copy_from_head=min(size_t(head_end-copy_begin),size);
15816
15817 copy_assign[size_of_copy_from_head](note::from(copy_begin),note::to(to));
15818 if(size!=size_of_copy_from_head){
15819 const size_t size_left=size-size_of_copy_from_head;
15820 char_T* next_copy_begin_pos=to+size_of_copy_from_head;
15821 _to->copy_part_data_to(next_copy_begin_pos,0,size_left);
15822 }
15823 }
15824 else
15825 _to->copy_part_data_to(to,pos-_used_size,size);
15826 }
15827 public:
15828 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{
15829 if(index<_used_size){
15830 const char_T* head_begin=_m.end()-_used_size;
15831 return head_begin[index];
15832 }
15833 else
15834 return _to->arec(index-_used_size);
15835 }
15836 virtual void arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
15837 if(this->is_unique()){
15838 if(index<_used_size){
15839 char_T* head_begin=_m.end()-_used_size;
15840 copy_assign(head_begin[index],a);
15841 }
15842 else
15843 _to->arec_set(index-_used_size,a,_to);
15844 self_changed();
15845 }
15846 else
15847 base_t::arec_set(index,a,p);
15848 }
15849 [[nodiscard]]virtual ptr_t apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
15850 if(this->is_unique()){
15851 if(_m.size()-_used_size<str.size()){
15852 const auto size_now=this->get_size()+str.size();
15853 const auto size_new=get_next_gold_size_to_resize_for_array(size_now);
15854 _m.insert_with_forward_resize(0,str.size(),str.begin(),size_new);
15855 }
15856 else
15857 copy_assign[str.size()](note::from<const char_T*>(str.begin()),note::to<char_T*>(_m.end()-_used_size-str.size()));
15858 _used_size+=str.size();
15859 self_changed();
15860 return this;
15861 }
15862 else
15863 return base_t::apply_str_to_begin(str);
15864 }
15865 [[nodiscard]]virtual ptr_t apply_str_to_begin(ptr_t str)noexcept(apply_data_nothrow)override final{
15866 this->shrink();
15867 return base_t::apply_str_to_begin(str);
15868 }
15869 void shrink()noexcept(_m.forward_resize_nothrow){
15870 _m.forward_resize(_used_size);
15871 }
15872 [[nodiscard]]virtual ptr_t apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
15873 if(this->is_unique()){
15874 _to=_to->apply_str_to_end(str);
15875 _to_size+=str.size();
15876 self_changed();
15877 return this;
15878 }
15879 else
15880 return base_t::apply_str_to_end(str);
15881 }
15882 [[nodiscard]]virtual ptr_t apply_str_to_end(ptr_t str)noexcept(apply_data_nothrow)override final{
15883 if(this->is_unique()){
15884 _to=_to->apply_str_to_end(str);
15885 _to_size+=str->get_size();
15886 self_changed();
15887 return this;
15888 }
15889 else
15890 return base_t::apply_str_to_end(str);
15891 }
15892 [[nodiscard]]virtual ptr_t do_pop_front(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
15893 if(this->is_unique() && _used_size>=size){
15894 _used_size-=size;
15895 self_changed();
15896 return get<comn_string_data_t<char_T>>(string_view_t{(char_T*)_m.end()-_used_size-size,size});
15897 }
15898 else
15899 return base_t::do_pop_front(size,self);
15900 }
15901 [[nodiscard]]virtual ptr_t do_pop_back(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
15902 if(this->is_unique()){
15903 auto aret=_to->do_pop_back(size,_to);
15904 _to_size-=size;
15905 self_changed();
15906 return aret;
15907 }
15908 else
15909 return base_t::do_pop_back(size,self);
15910 }
15911 protected:
15912 virtual hash_t get_hash_detail(ptr_t&)noexcept(hash_nothrow)override final{
15913 suppress_msvc_warning(26494)//未初始化警告diss
15914 hash_t result;
15915 if(_used_size){
15916 const char_T* head_begin=_m.end()-_used_size;
15917 result=hash(head_begin,_used_size);
15918 if(_to_size)
15919 result=hash.merge_array_hash_results(result,_used_size,_to->get_hash(_to),_to_size);
15920 }
15921 else
15922 result=_to->get_hash(_to);
15923 return result;
15924 }
15925 virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before,size_t before_size,ptr_t&,size_t pos,size_t size)noexcept(hash_nothrow)override final{
15926 if(pos<_used_size){
15927 const char_T* head_begin=_m.end()-_used_size;
15928 const char_T* head_end=_m.end();
15929 const char_T* calculate_begin=pos+head_begin;
15930 const size_t size_of_calculate_from_head=min(size_t(head_end-calculate_begin),size);
15931
15932 before=hash.with_calculated_before(before,before_size,calculate_begin,size_of_calculate_from_head);
15933 if(size!=size_of_calculate_from_head){
15934 const size_t size_left=size-size_of_calculate_from_head;
15935 before_size+=size_of_calculate_from_head;
15936 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,0,size_left);
15937 }
15938 }
15939 else
15940 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos-_used_size,size);
15941 return before;
15942 }
15943 protected:
15944 [[nodiscard]]virtual bool same_struct(ptr_t with)noexcept override final{
15945 auto wp=down_cast<this_t*>(with.get());
15946 return _used_size==wp->_used_size;// && _to_size==wp->_to_size; //总size被保证一样
15947 }
15948 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form(size_t begin)noexcept override final{
15949 if(begin >= _used_size)
15950 return _to->get_the_largest_complete_data_block_begin_form(begin-_used_size);
15951 else {
15952 const char_T* head_begin = _m.end() - _used_size;
15953 const char_T* head_end = _m.end();
15954 const char_T* ret_begin = begin+head_begin;
15955 return {ret_begin, head_end};
15956 }
15957 }
15958 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
15959 auto wp=down_cast<this_t*>(with.get());
15960 const char_T* head_begin = _m.end() - _used_size;
15961 const char_T* wp_head_begin = wp->_m.end() - _used_size;
15962 if(!equal(head_begin,wp_head_begin,_used_size))
15963 return false;
15964 return _to->equal_with(wp->_to);
15965 }
15966 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
15967 auto wp=down_cast<this_t*>(with.get());
15968 const char_T* head_begin = _m.end() - _used_size;
15969 const char_T* wp_head_begin = wp->_m.end() - _used_size;
15970 if(auto tmp=compare(head_begin,wp_head_begin,_used_size); tmp!=0)
15971 return tmp;
15972 return _to->compare_with(wp->_to);
15973 }
15974 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
15975 return _to->get_memory_cost()+float_size_of(*this)+_m.size_in_byte();
15976 }
15977 };
15978 template<typename char_T>
15979 [[nodiscard]]base_string_data_t<char_T>::ptr_t base_string_data_t<char_T>::apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow){
15980 if(str.size())
15981 return get<head_apply_string_data_t<char_T>>(this,str);
15982 else
15983 return this;
15984 }
15985
15986 //file_end
15987
15988 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
15989 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/end_apply_string_data_t.hpp"
15990 //end_apply_string_data_t.hpp
15991 //at namespace elc::defs::string_n::string_data_n
15992 /*
15993 未完成的elc解释器string文件
15994 由steve02081504与Alex0125设计、编写
15995 转载时请在不对此文件做任何修改的同时注明出处
15996 项目地址:https://github.com/steve02081504/ELC
15997 */
15998 template<typename char_T>
15999 struct end_apply_string_data_t final:base_string_data_t<char_T>,instance_struct<end_apply_string_data_t<char_T>>{
16001 typedef base_string_data_t<char_T> base_t;
16002 using base_t::ptr_t;
16003 using base_t::string_view_t;
16004 using base_t::self_changed;
16005
16006 using base_t::copy_assign_nothrow;
16007 using base_t::copy_construct_nothrow;
16008 using base_t::move_construct_nothrow;
16009 using base_t::construct_nothrow;
16010 using base_t::destruct_nothrow;
16011 using base_t::clear_nothrow;
16012 using base_t::ptr_reset_nothrow;
16013 using base_t::hash_nothrow;
16014 using base_t::get_data_nothrow;
16015 using base_t::apply_data_nothrow;
16016 using base_t::set_hash_cache;
16017
16018 array_t<char_T> _m;
16019 ptr_t _to;
16020 size_t _to_size;
16021 size_t _used_size;
16022
16023 end_apply_string_data_t(ptr_t str,string_view_t end)noexcept(construct_nothrow&&copy_assign_nothrow):
16024 _to_size(str->get_size()),
16025 _used_size(end.size()),
16026 _to(str)
16027 {
16028 _m.resize(get_next_gold_size_to_resize_for_array(_to_size+_used_size));
16029 copy_assign[_used_size](note::from(end.begin()),note::to((char_T*)_m));
16030 }
16031 end_apply_string_data_t(ptr_t str,size_t count,char_T ch)noexcept:
16032 _to_size(str->get_size()),
16033 _used_size(count),
16034 _to(str)
16035 {
16036 _m.resize(get_next_gold_size_to_resize_for_array(_to_size+_used_size));
16037 copy_assign[_used_size](ch,note::to((char_T*)_m));
16038 }
16039 end_apply_string_data_t(ptr_t str,size_t count)noexcept:
16040 _to_size(str->get_size()),
16041 _used_size(count),
16042 _to(str)
16043 {
16044 _m.resize(get_next_gold_size_to_resize_for_array(_to_size+_used_size));
16045 }
16046
16047 [[nodiscard]]virtual ptr_t get_substr_data(size_t begin,size_t size)noexcept override final{
16048 if(begin+size<=_to_size)
16049 return _to->get_substr_data(begin,size);
16050 else
16051 return base_t::get_substr_data(begin,size);
16052 }
16053 [[nodiscard]]virtual char_T* get_c_str(ptr_t&p)noexcept(get_data_nothrow)override final{
16054 if(!_used_size)
16055 return _to->get_c_str(_to);
16056 else
16057 return base_t::get_c_str(p);
16058 }
16059 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{
16060 if(type_info<this_t> == typeid(*a)){
16061 const auto p = down_cast<this_t*>(a.get());
16062 if(_used_size==p->_used_size && _to!=p->_to)
16063 base_t::equivalent_optimization(_to, p->_to);
16064 }
16065 _m.clear();
16066 _to.reset();
16067 base_t::be_replace_as(a);
16068 }
16069 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _used_size+_to_size; }
16070 [[nodiscard]]virtual ptr_t do_insert(size_t pos,string_view_t str)noexcept(copy_construct_nothrow)override final{
16071 if(pos==0)
16072 return this->apply_str_to_begin(str);
16073 elseif(pos==get_size())
16074 return this->apply_str_to_end(str);
16075 elseif(this->is_unique()){
16076 if(pos<_to_size)
16077 return _to->do_insert(pos-_used_size,str);
16078 else{
16079 pos-=_to_size;
16080 if(_m.size()-_used_size<str.size()){
16081 const auto size_now=this->get_size()+str.size();
16082 const auto size_new=get_next_gold_size_to_resize_for_array(size_now);
16083 _m.insert_with_resize(pos,str.size(),str.begin(),size_new);
16084 }
16085 else{
16086 copy_assign[_used_size-pos](note::from<const char_T*>(&_m[pos]),note::to((char_T*)&_m[pos+str.size()]));
16087 copy_assign[str.size()](note::from<const char_T*>(str.begin()),note::to<char_T*>(&_m[pos]));
16088 }
16089 _used_size+=str.size();
16090 self_changed();
16091 return this;
16092 }
16093 }
16094 else
16095 return base_t::do_insert(pos,str);
16096 }
16097 protected:
16098 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{
16099 if(pos+size<=_to_size)
16100 _to->copy_part_data_to(to,pos,size);
16101 else{
16102 if(pos<_to_size){
16103 _to->copy_part_data_to(to,pos,_to_size-pos);
16104 auto copied_size=_to_size-pos;
16105 pos=0;
16106 size-=copied_size;
16107 to+=copied_size;
16108 }
16109 else
16110 pos-=_to_size;
16111 copy_assign[size](note::from((const char_T*)_m+pos),note::to(to));
16112 }
16113 }
16114 public:
16115 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{
16116 if(index<_to_size)
16117 return _to->arec(index);
16118 else
16119 return _m[index-_to_size];
16120 }
16121 virtual void arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
16122 if(this->is_unique()){
16123 if(index<_to_size)
16124 _to->arec_set(index,a,_to);
16125 else
16126 copy_assign(_m[index - _to_size],a);
16127 self_changed();
16128 }
16129 else
16130 base_t::arec_set(index,a,p);
16131 }
16132
16133 [[nodiscard]]virtual ptr_t apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
16134 if(this->is_unique()){
16135 if(_m.size()-_used_size < str.size()){
16136 const auto size_now=this->get_size()+str.size();
16137 const auto size_new=get_next_gold_size_to_resize_for_array(size_now);
16138 _m.insert_with_resize(_used_size,str.size(),str.begin(),size_new);
16139 }
16140 else
16141 copy_assign[str.size()](note::from(str.begin()),note::to((char_T*)_m+_used_size));
16142 _used_size+=str.size();
16143 self_changed();
16144 return this;
16145 }
16146 else
16147 return base_t::apply_str_to_end(str);
16148 }
16149 [[nodiscard]]virtual ptr_t apply_str_to_end(ptr_t str)noexcept(apply_data_nothrow)override final{
16150 this->shrink();
16151 return base_t::apply_str_to_end(str);
16152 }
16153 [[nodiscard]]virtual ptr_t apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
16154 if(this->is_unique()){
16155 _to=_to->apply_str_to_begin(str);
16156 _to_size+=str.size();
16157 self_changed();
16158 return this;
16159 }
16160 else
16161 return base_t::apply_str_to_begin(str);
16162 }
16163 [[nodiscard]]virtual ptr_t apply_str_to_begin(ptr_t str)noexcept(apply_data_nothrow)override final{
16164 if(this->is_unique()){
16165 _to=_to->apply_str_to_begin(str);
16166 _to_size+=str->get_size();
16167 self_changed();
16168 return this;
16169 }
16170 else
16171 return base_t::apply_str_to_begin(str);
16172 }
16173 [[nodiscard]]virtual ptr_t do_pop_front(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
16174 if(this->is_unique()){
16175 auto aret=_to->do_pop_front(size,_to);
16176 _to_size-=size;
16177 self_changed();
16178 return aret;
16179 }
16180 else
16181 return base_t::do_pop_front(size,self);
16182 }
16183 [[nodiscard]]virtual ptr_t do_pop_back(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
16184 if(this->is_unique() && _used_size>=size){
16185 _used_size-=size;
16186 self_changed();
16187 return get<comn_string_data_t<char_T>>(string_view_t{(char_T*)_m+_used_size,size});
16188 }
16189 else
16190 return base_t::do_pop_back(size,self);
16191 }
16192 protected:
16193 virtual hash_t get_hash_detail(ptr_t&)noexcept(hash_nothrow)override final{
16194 return hash.with_calculated_before(_to->get_hash(_to),_to_size,string_view_t(_m.begin(),_used_size));
16195 }
16196 virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before,size_t before_size,ptr_t&,size_t pos,size_t size)noexcept(hash_nothrow)override final{
16197 if(pos+size<=_to_size)
16198 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos,size);
16199 else{
16200 if(pos<_to_size){
16201 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos,_to_size-pos);
16202 const auto calculated_size=_to_size-pos;
16203 pos=0;
16204 size-=calculated_size;
16205 before_size+=calculated_size;
16206 }
16207 else
16208 pos-=_to_size;
16209 before=hash.with_calculated_before(before,before_size,(const char_T*)_m+pos,size);
16210 }
16211 return before;
16212 }
16213 void shrink()noexcept(_m.resize_nothrow){
16214 _m.resize(_used_size);
16215 }
16216 protected:
16217 [[nodiscard]]virtual bool same_struct(ptr_t with)noexcept override final{
16218 auto wp = down_cast<this_t*>(with.get());
16219 return _used_size==wp->_used_size;// && _to_size==wp->_to_size; //总size被保证一样
16220 }
16221 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form(size_t begin)noexcept override final{
16222 if(begin < _to_size){
16223 return _to->get_the_largest_complete_data_block_begin_form(begin);
16224 }
16225 else {
16226 begin-=_to_size;
16227 return {_m.begin()+begin,note::size(_used_size-begin)};
16228 }
16229 }
16230 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
16231 auto wp=down_cast<this_t*>(with.get());
16232 if(!_to->equal_with(wp->_to))
16233 return false;
16234 return equal((char_T*)_m.begin(),(char_T*)wp->_m.begin(),_used_size);
16235 }
16236 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
16237 auto wp=down_cast<this_t*>(with.get());
16238 if(auto tmp=_to->compare_with(wp->_to); tmp!=0)
16239 return tmp;
16240 return compare((char_T*)_m.begin(),(char_T*)wp->_m.begin(),_used_size);
16241 }
16242 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
16243 return _to->get_memory_cost()+float_size_of(*this)+_m.size_in_byte();
16244 }
16245 };
16246 template<typename char_T>
16247 [[nodiscard]]base_string_data_t<char_T>::ptr_t base_string_data_t<char_T>::apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow){
16248 if(str.size())
16249 return get<end_apply_string_data_t<char_T>>(this,str);
16250 else
16251 return this;
16252 }
16253
16254 //file_end
16255
16256 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
16257
16258 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/sum_string_data_t.hpp"
16259 //sum_string_data_t.hpp
16260 //at namespace elc::defs::string_n::string_data_n
16261 /*
16262 未完成的elc解释器string文件
16263 由steve02081504与Alex0125设计、编写
16264 转载时请在不对此文件做任何修改的同时注明出处
16265 项目地址:https://github.com/steve02081504/ELC
16266 */
16267 template<typename char_T>
16268 struct sum_string_data_t final:base_string_data_t<char_T>,instance_struct<sum_string_data_t<char_T>>{
16271 using base_t::ptr_t;
16272 using base_t::string_view_t;
16273 using base_t::self_changed;
16274
16275 using base_t::copy_assign_nothrow;
16276 using base_t::copy_construct_nothrow;
16277 using base_t::move_construct_nothrow;
16278 using base_t::construct_nothrow;
16279 using base_t::destruct_nothrow;
16280 using base_t::clear_nothrow;
16281 using base_t::ptr_reset_nothrow;
16282 using base_t::hash_nothrow;
16283 using base_t::get_data_nothrow;
16284 using base_t::apply_data_nothrow;
16285 using base_t::set_hash_cache;
16286
16287 ptr_t _before;
16288 ptr_t _after;
16289 size_t _before_size;
16290 size_t _after_size;
16291
16292 sum_string_data_t(ptr_t before,ptr_t after)noexcept:_before(before),_after(after),_before_size(_before->get_size()),_after_size(_after->get_size()){
16293 if(!_before_size)
16294 be_replace_as(_after);
16295 elseif(!_after_size)
16296 be_replace_as(_before);
16297 }
16298
16299 [[nodiscard]]virtual ptr_t get_substr_data(size_t begin,size_t size)noexcept override final{
16300 if(begin+size<=_before_size)
16301 return _before->get_substr_data(begin,size);
16302 elseif(begin>=_before_size)
16303 return _after->get_substr_data(begin-_before_size,size);
16304 else
16305 return base_t::get_substr_data(begin,size);
16306 }
16307 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{
16308 if(type_info<this_t> == typeid(*a)){
16309 const auto p = down_cast<this_t*>(a.get());
16310 if(_before_size==p->_before_size){
16311 if(_before!=p->_before)
16312 base_t::equivalent_optimization(_before, p->_before);
16313 if(_after!=p->_after)
16314 base_t::equivalent_optimization(_after, p->_after);
16315 }
16316 }
16317 _before.reset();
16318 _after.reset();
16319 base_t::be_replace_as(a);
16320 }
16321 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _before_size+_after_size; }
16322 protected:
16323 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{
16324 if(pos<_before_size){
16325 const auto copy_before_begin=pos;
16326 const auto copy_before_end=min(pos+size,_before_size);
16327 const auto copy_before_size=copy_before_end-copy_before_begin;
16328 _before->copy_part_data_to(to,copy_before_begin,copy_before_size);
16329 if(size!=copy_before_size){
16330 const auto copy_after_size=size-copy_before_size;
16331 to+=copy_before_size;
16332 _after->copy_part_data_to(to,0,copy_after_size);
16333 }
16334 }
16335 else
16336 _after->copy_part_data_to(to,pos-_before_size,size);
16337 }
16338 public:
16339 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{
16340 if(index<_before_size)
16341 return _before->arec(index);
16342 else
16343 return _after->arec(index-_before_size);
16344 }
16345 virtual void arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
16346 if(this->is_unique()){
16347 if(index<_before_size)
16348 _before->arec_set(index,a,_before);
16349 else
16350 _after->arec_set(index-_before_size,a,_after);
16351 self_changed();
16352 }
16353 else
16354 base_t::arec_set(index,a,p);
16355 }
16356 [[nodiscard]]virtual ptr_t apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
16357 if(this->is_unique()){
16358 _before=_before->apply_str_to_begin(str);
16359 _before_size+=str.size();
16360 self_changed();
16361 return this;
16362 }
16363 else
16364 return base_t::apply_str_to_begin(str);
16365 }
16366 [[nodiscard]]virtual ptr_t apply_str_to_begin(ptr_t str)noexcept(apply_data_nothrow)override final{
16367 if(this->is_unique()){
16368 _before=_before->apply_str_to_begin(str);
16369 _before_size+=str->get_size();
16370 self_changed();
16371 return this;
16372 }
16373 else
16374 return base_t::apply_str_to_begin(str);
16375 }
16376 [[nodiscard]]virtual ptr_t apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
16377 if(this->is_unique()){
16378 _after=_after->apply_str_to_end(str);
16379 _after_size+=str.size();
16380 self_changed();
16381 return this;
16382 }
16383 else
16384 return base_t::apply_str_to_end(str);
16385 }
16386 [[nodiscard]]virtual ptr_t apply_str_to_end(ptr_t str)noexcept(apply_data_nothrow)override final{
16387 if(this->is_unique()){
16388 _after=_after->apply_str_to_end(str);
16389 _after_size+=str->get_size();
16390 self_changed();
16391 return this;
16392 }
16393 else
16394 return base_t::apply_str_to_end(str);
16395 }
16396 [[nodiscard]]virtual ptr_t do_pop_front(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
16397 if(this->is_unique() && _before_size>=size){
16398 ptr_t aret;
16399 if(_before_size==size)
16400 swap(aret,_before);
16401 else
16402 aret=_before->do_pop_front(size,_before);
16403 _before_size-=size;
16404 if(!_before_size)
16405 be_replace_as(_after);
16406 self_changed();
16407 return aret;
16408 }
16409 else
16410 return base_t::do_pop_front(size,self);
16411 }
16412 [[nodiscard]]virtual ptr_t do_pop_back(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
16413 if(this->is_unique() && _after_size>=size){
16414 ptr_t aret;
16415 if(_before_size==size)
16416 swap(aret,_after);
16417 else
16418 aret=_after->do_pop_back(size,_after);
16419 _after_size-=size;
16420 if(!_after_size)
16421 be_replace_as(_before);
16422 self_changed();
16423 return aret;
16424 }
16425 else
16426 return base_t::do_pop_back(size,self);
16427 }
16428 protected:
16429 virtual hash_t get_hash_detail(ptr_t&)noexcept(hash_nothrow)override final{
16430 suppress_msvc_warning(26494)//未初始化警告diss
16431 hash_t result;
16432 if(_before_size){
16433 result=_before->get_hash(_before);
16434 if(_after_size)
16435 result=hash.merge_array_hash_results(result,_before_size,_after->get_hash(_after),_after_size);
16436 }
16437 else
16438 result=_after->get_hash(_after);
16439 return result;
16440 }
16441 virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before,size_t before_size,ptr_t&,size_t pos,size_t size)noexcept(hash_nothrow)override final{
16442 if(pos<_before_size){
16443 const auto calculate_before_begin=pos;
16444 const auto calculate_before_end=min(pos+size,_before_size);
16445 const auto calculate_before_size=calculate_before_end-calculate_before_begin;
16446 before=_before->get_others_hash_with_calculated_before(before,before_size,_before,calculate_before_begin,calculate_before_size);
16447 if(size!=calculate_before_size){
16448 const auto calculate_after_size=size-calculate_before_size;
16449 before_size+=calculate_before_size;
16450 before=_after->get_others_hash_with_calculated_before(before,before_size,_after,0,calculate_after_size);
16451 }
16452 }
16453 else
16454 before=_after->get_others_hash_with_calculated_before(before,before_size,_after,pos-_before_size,size);
16455 return before;
16456 }
16457 protected:
16458 [[nodiscard]]virtual bool same_struct(ptr_t with)noexcept override final{
16459 auto wp=down_cast<this_t*>(with.get());
16460 return _before_size==wp->_before_size;//总size被保证一样
16461 }
16462 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form(size_t begin)noexcept override final{
16463 if(begin < _before_size)
16464 return _before->get_the_largest_complete_data_block_begin_form(begin);
16465 else
16466 return _after->get_the_largest_complete_data_block_begin_form(begin - _before_size);
16467 }
16468 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
16469 auto wp=down_cast<this_t*>(with.get());
16470 if(!this->_before->equal_with(wp->_before))
16471 return false;
16472 return this->_after->equal_with(wp->_after);
16473 }
16474 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
16475 auto wp=down_cast<this_t*>(with.get());
16476 if(auto tmp=this->_before->compare_with(wp->_before); tmp!=0)
16477 return tmp;
16478 return this->_after->compare_with(wp->_after);
16479 }
16480 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
16481 return float_size_of(*this)+_before->get_memory_cost()+_after->get_memory_cost();
16482 }
16483 };
16484 template<typename char_T>
16485 [[nodiscard]]base_string_data_t<char_T>::ptr_t base_string_data_t<char_T>::apply_str_to_end(ptr_t str)noexcept(apply_data_nothrow){
16486 return get<sum_string_data_t<char_T>>(this,str);
16487 }
16488 template<typename char_T>
16489 [[nodiscard]]base_string_data_t<char_T>::ptr_t base_string_data_t<char_T>::apply_str_to_begin(ptr_t str)noexcept(apply_data_nothrow){
16490 return get<sum_string_data_t<char_T>>(str,this);
16491 }
16492
16493 //file_end
16494
16495 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
16496
16497 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/erased_string_data_t.hpp"
16498 //erased_string_data_t.hpp
16499 //at namespace elc::defs::string_n::string_data_n
16500 /*
16501 未完成的elc解释器string文件
16502 由steve02081504与Alex0125设计、编写
16503 转载时请在不对此文件做任何修改的同时注明出处
16504 项目地址:https://github.com/steve02081504/ELC
16505 */
16506 template<typename char_T>
16507 struct erased_string_data_t final:base_string_data_t<char_T>,instance_struct<erased_string_data_t<char_T>>{
16509 typedef base_string_data_t<char_T> base_t;
16510 using base_t::ptr_t;
16511 using base_t::string_view_t;
16512 using base_t::self_changed;
16513
16514 using base_t::copy_assign_nothrow;
16515 using base_t::copy_construct_nothrow;
16516 using base_t::move_construct_nothrow;
16517 using base_t::construct_nothrow;
16518 using base_t::destruct_nothrow;
16519 using base_t::clear_nothrow;
16520 using base_t::ptr_reset_nothrow;
16521 using base_t::hash_nothrow;
16522 using base_t::get_data_nothrow;
16523 using base_t::apply_data_nothrow;
16524 using base_t::set_hash_cache;
16525
16526 ptr_t _to;
16527 size_t _to_size;
16528 size_t _erase_pos;
16529 size_t _erase_size;
16530
16531 void null_equivalent_check()noexcept{
16532 if(_to_size==_erase_size || !_to_size)
16533 be_replace_as(null_ptr);
16534 }
16535
16536 erased_string_data_t(ptr_t str,size_t erase_pos,size_t erase_size)noexcept:_to(str),_to_size(_to->get_size()),_erase_pos(erase_pos),_erase_size(erase_size){
16537 null_equivalent_check();
16538 }
16539
16540 [[nodiscard]]virtual ptr_t get_substr_data(size_t begin,size_t size)noexcept override final{
16541 if(begin+size<_erase_pos)
16542 return _to->get_substr_data(begin,size);
16543 elseif(begin>_erase_pos)
16544 return _to->get_substr_data(begin+_erase_size,size);
16545 else
16546 return base_t::get_substr_data(begin,size);
16547 }
16548 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final {
16549 if(type_info<this_t> == typeid(*a)){
16550 const auto p = down_cast<this_t*>(a.get());
16551 if(_erase_pos==p->_erase_pos && _erase_size==p->_erase_size && _to!=p->_to)
16552 base_t::equivalent_optimization(_to, p->_to);
16553 }
16554 _to.reset();
16555 base_t::be_replace_as(a);
16556 }
16557 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _to_size-_erase_size; }
16558 protected:
16559 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{
16560 if(pos+size<_erase_pos)
16561 _to->copy_part_data_to(to,pos,size);
16562 elseif(pos>_erase_pos)
16563 _to->copy_part_data_to(to,pos+_erase_size,size);
16564 else{
16565 const auto size_before_erase_pos=_erase_pos-pos;
16566 const auto size_after_erase_pos=size-size_before_erase_pos;
16567 _to->copy_part_data_to(to,pos,size_before_erase_pos);
16568 _to->copy_part_data_to(to+size_before_erase_pos,_erase_pos+_erase_size,size_after_erase_pos);
16569 }
16570 }
16571 public:
16572 [[nodiscard]]virtual ptr_t do_erase(size_t pos,size_t size)noexcept override final{
16573 if(this->is_unique()){
16574 if(pos<=_erase_pos && pos+size>=_erase_pos+_erase_size){
16575 _erase_pos=pos;
16576 _erase_size+=size;
16577 self_changed();
16578 return this;
16579 }
16580 }
16581 return base_t::do_erase(pos,size);
16582 }
16583 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{
16584 if(index>_erase_pos)
16585 return _to->arec(index+_erase_size);
16586 else
16587 return _to->arec(index);
16588 }
16589
16590 virtual void arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
16591 if(this->is_unique()){
16592 if(index>_erase_pos)
16593 _to->arec_set(index+_erase_size,a,_to);
16594 else
16595 _to->arec_set(index,a,_to);
16596 self_changed();
16597 }
16598 else
16599 base_t::arec_set(index,a,p);
16600 }
16601 [[nodiscard]]virtual ptr_t apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
16602 if(this->is_unique()){
16603 _to=_to->apply_str_to_begin(str);
16604 const auto strsize=str.size();
16605 _to_size+=strsize;
16606 _erase_pos+=strsize;
16607 self_changed();
16608 return this;
16609 }
16610 else
16611 return base_t::apply_str_to_begin(str);
16612 }
16613 [[nodiscard]]virtual ptr_t apply_str_to_begin(ptr_t str)noexcept(apply_data_nothrow)override final{
16614 if(this->is_unique()){
16615 _to=_to->apply_str_to_begin(str);
16616 const auto strsize=str->get_size();
16617 _to_size+=strsize;
16618 _erase_pos+=strsize;
16619 self_changed();
16620 return this;
16621 }
16622 else
16623 return base_t::apply_str_to_begin(str);
16624 }
16625 [[nodiscard]]virtual ptr_t apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
16626 if(this->is_unique()){
16627 _to=_to->apply_str_to_end(str);
16628 _to_size+=str.size();
16629 self_changed();
16630 return this;
16631 }
16632 else
16633 return base_t::apply_str_to_end(str);
16634 }
16635 [[nodiscard]]virtual ptr_t apply_str_to_end(ptr_t str)noexcept(apply_data_nothrow)override final{
16636 if(this->is_unique()){
16637 _to=_to->apply_str_to_end(str);
16638 _to_size+=str->get_size();
16639 self_changed();
16640 return this;
16641 }
16642 else
16643 return base_t::apply_str_to_end(str);
16644 }
16645 [[nodiscard]]virtual ptr_t do_pop_front(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
16646 if(this->is_unique() && _erase_pos > size){
16647 auto aret=_to->do_pop_front(size,_to);
16648 _to_size-=size;
16649 _erase_pos-=size;
16650 null_equivalent_check();
16651 self_changed();
16652 return aret;
16653 }
16654 else
16655 return base_t::do_pop_front(size,self);
16656 }
16657 [[nodiscard]]virtual ptr_t do_pop_back(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
16658 if(this->is_unique() && _erase_pos+_erase_size <= _to_size-size){
16659 auto aret=_to->do_pop_back(size,_to);
16660 _to_size-=size;
16661 null_equivalent_check();
16662 self_changed();
16663 return aret;
16664 }
16665 else
16666 return base_t::do_pop_back(size,self);
16667 }
16668 protected:
16669 virtual hash_t get_hash_detail(ptr_t&)noexcept(hash_nothrow)override final{
16670 auto result=hash(nothing);
16671 const auto size=get_size();
16672 const auto size_before_erase_pos=_erase_pos;
16673 const auto size_after_erase_pos=size-size_before_erase_pos;
16674 result=_to->get_others_hash_with_calculated_before(result,0,_to,0,size_before_erase_pos);
16675 result=_to->get_others_hash_with_calculated_before(result,size_before_erase_pos,_to,_erase_pos+_erase_size,size_after_erase_pos);
16676 return result;
16677 }
16678 virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before,size_t before_size,ptr_t&,size_t pos,size_t size)noexcept(hash_nothrow)override final{
16679 if(pos+size<_erase_pos)
16680 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos,size);
16681 elseif(pos>_erase_pos)
16682 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos+_erase_size,size);
16683 else{
16684 const auto size_before_erase_pos=_erase_pos-pos;
16685 const auto size_after_erase_pos=size-size_before_erase_pos;
16686 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos,size_before_erase_pos);
16687 before=_to->get_others_hash_with_calculated_before(before,before_size+size_before_erase_pos,_to,_erase_pos+_erase_size,size_after_erase_pos);
16688 }
16689 return before;
16690 }
16691 protected:
16692 [[nodiscard]]virtual bool same_struct(ptr_t with)noexcept override final{
16693 auto wp = down_cast<this_t*>(with.get());
16694 return _erase_pos == wp->_erase_pos && _erase_size == wp->_erase_size;
16695 }
16696 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form(size_t begin)noexcept override final{
16697 if(begin < _erase_pos){
16698 auto aret=_to->get_the_largest_complete_data_block_begin_form(begin);
16699 if(aret.size() > _erase_pos){
16700 aret = {aret.begin(),_erase_pos};
16701 }
16702 return aret;
16703 }
16704 else
16705 return _to->get_the_largest_complete_data_block_begin_form(begin + _erase_size);
16706 }
16707 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
16708 auto wp=down_cast<this_t*>(with.get());
16709 if(!_to->equal_with(wp->_to,0,_erase_pos))
16710 return false;
16711 return _to->equal_with(wp->_to,_erase_pos+_erase_size,_to_size);
16712 }
16713 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
16714 auto wp=down_cast<this_t*>(with.get());
16715 if(auto tmp=_to->compare_with(wp->_to,0,_erase_pos); tmp!=0)
16716 return tmp;
16717 return _to->compare_with(wp->_to,_erase_pos+_erase_size,_to_size);
16718 }
16719 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
16720 return float_size_of(*this)+_to->get_memory_cost();
16721 }
16722 };
16723 template<typename char_T>
16724 [[nodiscard]]base_string_data_t<char_T>::ptr_t base_string_data_t<char_T>::do_erase(size_t pos,size_t size)noexcept{
16725 if(size==get_size())
16726 return null_ptr;
16727 else
16728 return get<erased_string_data_t<char_T>>(this,pos,size);
16729 }
16730
16731 //file_end
16732
16733 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
16734 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/inserted_string_data_t.hpp"
16735 //inserted_string_data_t.hpp
16736 //at namespace elc::defs::string_n::string_data_n
16737 /*
16738 未完成的elc解释器string文件
16739 由steve02081504与Alex0125设计、编写
16740 转载时请在不对此文件做任何修改的同时注明出处
16741 项目地址:https://github.com/steve02081504/ELC
16742 */
16743 template<typename char_T>
16744 struct inserted_string_data_t final: base_string_data_t<char_T>,instance_struct<inserted_string_data_t<char_T>>{
16746 typedef base_string_data_t<char_T> base_t;
16747 using base_t::ptr_t;
16748 using base_t::string_view_t;
16749 using base_t::self_changed;
16750
16751 using base_t::copy_assign_nothrow;
16752 using base_t::copy_construct_nothrow;
16753 using base_t::move_construct_nothrow;
16754 using base_t::construct_nothrow;
16755 using base_t::destruct_nothrow;
16756 using base_t::clear_nothrow;
16757 using base_t::ptr_reset_nothrow;
16758 using base_t::hash_nothrow;
16759 using base_t::get_data_nothrow;
16760 using base_t::apply_data_nothrow;
16761 using base_t::set_hash_cache;
16762
16763 ptr_t _to;
16764 ptr_t _insert_data;
16765 size_t _to_size;
16766 size_t _insert_pos;
16767 size_t _insert_size;
16768
16769 inserted_string_data_t(ptr_t to,ptr_t insert_data,size_t insert_pos)noexcept:_to(to),_insert_data(insert_data),_insert_pos(insert_pos),_to_size(to->get_size()),_insert_size(insert_data->get_size()){}
16770
16771 [[nodiscard]]virtual ptr_t get_substr_data(size_t begin,size_t size)noexcept override final{
16772 if(begin+size<_insert_pos)
16773 return _to->get_substr_data(begin,size);
16774 elseif(begin>_insert_pos+_insert_size)
16775 return _to->get_substr_data(begin-_insert_size,size);
16776 elseif(begin>=_insert_pos && begin+size<=_insert_pos+_insert_size)
16777 return _insert_data->get_substr_data(begin-_insert_pos,size);
16778 else
16779 return base_t::get_substr_data(begin,size);
16780 }
16781 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{
16782 if(type_info<this_t> == typeid(*a)){
16783 const auto p = down_cast<this_t*>(a.get());
16784 if(_insert_pos==p->_insert_pos && _insert_size==p->_insert_size){
16785 if(_to!=p->_to)
16786 base_t::equivalent_optimization(_to, p->_to);
16787 if(_insert_data!=p->_insert_data)
16788 base_t::equivalent_optimization(_insert_data, p->_insert_data);
16789 }
16790 }
16791 _to.reset();
16792 _insert_data.reset();
16793 base_t::be_replace_as(a);
16794 }
16795 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _to_size+_insert_size; }
16796 protected:
16797 virtual void copy_part_data_to(char_T* to,size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{
16798 if(pos+size<_insert_pos)
16799 _to->copy_part_data_to(to,pos,size);
16800 elseif(pos>_insert_pos+_insert_size)
16801 _to->copy_part_data_to(to,pos-_insert_size,size);
16802 else{
16803 if(_insert_pos>pos){
16804 auto size_before_insert_pos=_insert_pos-pos;
16805 _to->copy_part_data_to(to,pos,size_before_insert_pos);
16806 to+=size_before_insert_pos;
16807 size-=size_before_insert_pos;
16808 }
16809 auto size_before_insert_end=min(size,_insert_size);
16810 _insert_data->copy_part_data_to(to,0,size_before_insert_end);
16811 to+=size_before_insert_end;
16812 size-=size_before_insert_end;
16813 if(size)
16814 _to->copy_part_data_to(to,_insert_pos,size);
16815 }
16816 }
16817 public:
16818 [[nodiscard]]virtual ptr_t do_insert(size_t pos,string_view_t str)noexcept(copy_construct_nothrow)override final{
16819 if(this->is_unique()){
16820 if(pos>=_insert_pos && pos<=_insert_pos+_insert_size){
16821 _insert_data=_insert_data->do_insert(pos-_insert_pos,str);
16822 _insert_size+=str.size();
16823 self_changed();
16824 return this;
16825 }
16826 elseif(pos<_insert_pos){
16827 _to=_to->do_insert(pos,str);
16828 _to_size+=str.size();
16829 _insert_pos+=str.size();
16830 self_changed();
16831 return this;
16832 }
16833 elseif(pos>_insert_pos+_insert_size){
16834 _to=_to->do_insert(pos-_insert_size,str);
16835 _to_size+=str.size();
16836 self_changed();
16837 return this;
16838 }
16839 }
16840 return base_t::do_insert(pos,str);
16841 }
16842 [[nodiscard]]virtual ptr_t do_erase(size_t pos,size_t size)noexcept override final{
16843 if(this->is_unique()){
16844 if(pos>=_insert_pos && pos+size<=_insert_pos+_insert_size){
16845 _insert_data=_insert_data->do_erase(pos-_insert_pos,size);
16846 _insert_size-=size;
16847 self_changed();
16848 return this;
16849 }
16850 elseif(pos+size<_insert_pos){
16851 _to=_to->do_erase(pos,size);
16852 _to_size-=size;
16853 _insert_pos-=size;
16854 self_changed();
16855 return this;
16856 }
16857 elseif(pos>_insert_pos+_insert_size){
16858 _to=_to->do_erase(pos-_insert_size,size);
16859 _to_size-=size;
16860 self_changed();
16861 return this;
16862 }
16863 }
16864 return base_t::do_erase(pos,size);
16865 }
16866 [[nodiscard]]virtual char_T arec(size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{
16867 if(index>=_insert_pos && index<_insert_pos+_insert_size)
16868 return _insert_data->arec(index-_insert_pos);
16869 elseif(index>=_insert_pos+_insert_size)
16870 return _to->arec(index-_insert_size);
16871 else
16872 return _to->arec(index);
16873 }
16874
16875 virtual void arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
16876 if(this->is_unique()){
16877 if(index>=_insert_pos && index<_insert_pos+_insert_size)
16878 _insert_data->arec_set(index-_insert_pos,a,p);
16879 elseif(index>=_insert_pos+_insert_size)
16880 _to->arec_set(index-_insert_size,a,p);
16881 else
16882 _to->arec_set(index,a,p);
16883 self_changed();
16884 }
16885 else
16886 base_t::arec_set(index,a,p);
16887 }
16888 [[nodiscard]]virtual ptr_t apply_str_to_begin(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
16889 if(this->is_unique()){
16890 const auto size=str.size();
16891 if(_insert_pos==0){
16892 _insert_data=_insert_data->apply_str_to_begin(str);
16893 _insert_size+=size;
16894 }
16895 else{
16896 _to=_to->apply_str_to_begin(str);
16897 _to_size+=str.size();
16898 _insert_pos+=size;
16899 }
16900 self_changed();
16901 return this;
16902 }
16903 else
16904 return base_t::apply_str_to_begin(str);
16905 }
16906 [[nodiscard]]virtual ptr_t apply_str_to_begin(ptr_t str)noexcept(apply_data_nothrow)override final{
16907 if(this->is_unique()){
16908 const auto size=str->get_size();
16909 if(_insert_pos==0){
16910 _insert_data=_insert_data->apply_str_to_begin(str);
16911 _insert_size+=size;
16912 }
16913 else{
16914 _to=_to->apply_str_to_begin(str);
16915 _to_size+=str->get_size();
16916 _insert_pos+=size;
16917 }
16918 self_changed();
16919 return this;
16920 }
16921 else
16922 return base_t::apply_str_to_begin(str);
16923 }
16924 [[nodiscard]]virtual ptr_t apply_str_to_end(string_view_t str)noexcept(copy_construct_nothrow&&apply_data_nothrow)override final{
16925 if(this->is_unique()){
16926 if(_insert_pos==_to_size){
16927 _insert_data=_insert_data->apply_str_to_end(str);
16928 _insert_size+=str.size();
16929 }
16930 else{
16931 _to=_to->apply_str_to_end(str);
16932 _to_size+=str.size();
16933 }
16934 self_changed();
16935 return this;
16936 }
16937 else
16938 return base_t::apply_str_to_end(str);
16939 }
16940 [[nodiscard]]virtual ptr_t apply_str_to_end(ptr_t str)noexcept(apply_data_nothrow)override final{
16941 if(this->is_unique()){
16942 if(_insert_pos==_to_size){
16943 _insert_data=_insert_data->apply_str_to_end(str);
16944 _insert_size+=str->get_size();
16945 }
16946 else{
16947 _to=_to->apply_str_to_end(str);
16948 _to_size+=str->get_size();
16949 }
16950 self_changed();
16951 return this;
16952 }
16953 else
16954 return base_t::apply_str_to_end(str);
16955 }
16956 [[nodiscard]]virtual ptr_t do_pop_front(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
16957 if(this->is_unique()){
16958 if(_insert_pos > size){
16959 auto aret=_to->do_pop_front(size,_to);
16960 _to_size-=size;
16961 _insert_pos-=size;
16962 self_changed();
16963 return aret;
16964 }
16965 elseif(_insert_pos==0 && _insert_size>=size){
16966 auto aret=_insert_data->do_pop_front(size,_insert_data);
16967 _insert_size-=size;
16968 self_changed();
16969 return aret;
16970 }
16971 }
16972 return base_t::do_pop_front(size,self);
16973 }
16974 [[nodiscard]]virtual ptr_t do_pop_back(size_t size,ptr_t& self)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
16975 if(this->is_unique()){
16976 if(_insert_pos+_insert_size <= _to_size-size){
16977 auto aret=_to->do_pop_back(size,_to);
16978 _to_size-=size;
16979 self_changed();
16980 return aret;
16981 }
16982 elseif(_insert_pos==_to_size && _insert_size>=size){
16983 auto aret=_insert_data->do_pop_front(size,_insert_data);
16984 _insert_size-=size;
16985 self_changed();
16986 return aret;
16987 }
16988 }
16989 return base_t::do_pop_back(size,self);
16990 }
16991 protected:
16992 virtual hash_t get_hash_detail(ptr_t&)noexcept(hash_nothrow)override final{
16993 auto result=hash(nothing);
16994 if(_insert_pos){
16995 result=_to->get_others_hash_with_calculated_before(result,0,_to,0,_insert_pos);
16996 }
16997 result=hash.merge_array_hash_results(result,_insert_pos,_insert_data->get_hash(_insert_data),_insert_size);
16998 const auto size=_to_size-_insert_pos;
16999 if(size)
17000 result=_to->get_others_hash_with_calculated_before(result,_insert_pos+_insert_size,_to,_insert_pos,size);
17001 return result;
17002 }
17003 virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before,size_t before_size,ptr_t&,size_t pos,size_t size)noexcept(hash_nothrow)override final{
17004 if(pos+size<_insert_pos)
17005 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos,size);
17006 elseif(pos>_insert_pos+_insert_size)
17007 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos-_insert_size,size);
17008 else{
17009 if(_insert_pos>pos){
17010 const auto size_before_insert_pos=_insert_pos-pos;
17011 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,pos,size_before_insert_pos);
17012 size-=size_before_insert_pos;
17013 before_size+=size_before_insert_pos;
17014 }
17015 auto size_before_insert_end=min(size,_insert_size);
17016 before=_insert_data->get_others_hash_with_calculated_before(before,before_size,_insert_data,0,size_before_insert_end);
17017 size-=size_before_insert_end;
17018 before_size+=size_before_insert_end;
17019 if(size)
17020 before=_to->get_others_hash_with_calculated_before(before,before_size,_to,_insert_pos,size);
17021 }
17022 return before;
17023 }
17024 protected:
17025 [[nodiscard]]virtual bool same_struct(ptr_t with)noexcept override final{
17026 auto wp=down_cast<this_t*>(with.get());
17027 return _insert_pos==wp->_insert_pos && _insert_size==wp->_insert_size;//总size被保证一样
17028 }
17029 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form(size_t index)noexcept override final{
17030 if(index>=_insert_pos && index<_insert_pos+_insert_size)
17031 return _insert_data->get_the_largest_complete_data_block_begin_form(index-_insert_pos);
17032 elseif(index>=_insert_pos+_insert_size)
17033 return _to->get_the_largest_complete_data_block_begin_form(index-_insert_size);
17034 else {
17035 auto aret=_to->get_the_largest_complete_data_block_begin_form(index);
17036 if(aret.size()+index > _insert_pos)
17037 aret = {aret.begin(), note::size(_insert_pos-index)};
17038 return aret;
17039 }
17040 }
17041 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
17042 auto wp=down_cast<this_t*>(with.get());
17043 if(!_insert_data->equal_with(wp->_insert_data))
17044 return false;
17045 return _to->equal_with(wp->_to);
17046 }
17047 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
17048 auto wp=down_cast<this_t*>(with.get());
17049 if(auto tmp=_to->compare_with(wp->_to,0,_insert_pos); tmp!=0)
17050 return tmp;
17051 if(auto tmp=_insert_data->compare_with(wp->_insert_data); tmp!=0)
17052 return tmp;
17053 return _to->compare_with(wp->_to,_insert_pos,_to_size-(_insert_pos+_insert_size));
17054 }
17055 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
17056 return float_size_of(*this)+_insert_data->get_memory_cost()+_to->get_memory_cost();
17057 }
17058 };
17059 template<typename char_T>
17061 return get<inserted_string_data_t<char_T>>(this,str,pos);
17062 }
17063 template<typename char_T>
17064 base_string_data_t<char_T>::ptr_t base_string_data_t<char_T>::do_insert(size_t pos,string_view_t str)noexcept(copy_construct_nothrow){
17065 if(pos==0)
17066 return this->apply_str_to_begin(str);
17067 elseif(pos==get_size())
17068 return this->apply_str_to_end(str);
17069 else
17070 return this->do_insert(pos,get<comn_string_data_t<char_T>>(str));
17071 }
17072
17073 //file_end
17074
17075 #line 27 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
17076
17077 //#include "replaced_string_data_t.hpp"
17078
17079 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/same_value_compress_string_data_t.hpp"
17080 //sum_string_data_t.hpp
17081 //at namespace elc::defs::string_n::string_data_n
17082 /*
17083 未完成的elc解释器string文件
17084 由steve02081504与Alex0125设计、编写
17085 转载时请在不对此文件做任何修改的同时注明出处
17086 项目地址:https://github.com/steve02081504/ELC
17087 */
17088 template<typename char_T>
17089 struct same_value_compress_string_data_t final:base_string_data_t<char_T>,instance_struct<same_value_compress_string_data_t<char_T>>{
17091 typedef base_string_data_t<char_T> base_t;
17092 using base_t::ptr_t;
17093 using base_t::string_view_t;
17094 using base_t::self_changed;
17095
17096 using base_t::copy_assign_nothrow;
17097 using base_t::copy_construct_nothrow;
17098 using base_t::move_construct_nothrow;
17099 using base_t::construct_nothrow;
17100 using base_t::destruct_nothrow;
17101 using base_t::clear_nothrow;
17102 using base_t::ptr_reset_nothrow;
17103 using base_t::hash_nothrow;
17104 using base_t::get_data_nothrow;
17105 using base_t::apply_data_nothrow;
17106 using base_t::set_hash_cache;
17107
17108 size_t _size;
17109 char_T _value;
17110
17111 same_value_compress_string_data_t(size_t size,char_T value)noexcept:_size(size),_value(value){}
17112
17113 virtual void be_replace_as(ptr_t a)noexcept(clear_nothrow)override final{
17114 base_t::be_replace_as(a);
17115 }
17116 [[nodiscard]]virtual ptr_t get_substr_data([[maybe_unused]]size_t begin,size_t size)noexcept override final{
17117 return get<same_value_compress_string_data_t<char_T>>(size,_value);
17118 }
17119 [[nodiscard]]virtual size_t get_size()noexcept override final{ return _size; }
17120 protected:
17121 virtual void copy_part_data_to(char_T* to,[[maybe_unused]]size_t pos,size_t size)noexcept(copy_assign_nothrow)override final{
17122 copy_assign[size](_value,note::to(to));
17123 }
17124 public:
17125 [[nodiscard]]virtual char_T arec([[maybe_unused]]size_t index)noexcept(copy_construct_nothrow&&move_construct_nothrow)override final{
17126 return _value;
17127 }
17128 virtual void arec_set(size_t index,char_T a,ptr_t& p)noexcept(copy_assign_nothrow&&move_construct_nothrow)override final{
17129 base_t::arec_set(index,a,p);
17130 }
17131 [[nodiscard]]virtual ptr_t do_pop_front(size_t size,ptr_t&)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
17132 if(this->is_unique()){
17133 _size-=size;
17134 self_changed();
17135 return this;
17136 }
17137 else
17138 return get<same_value_compress_string_data_t<char_T>>(_size-size,_value);
17139 }
17140 [[nodiscard]]virtual ptr_t do_pop_back(size_t size,ptr_t&)noexcept(construct_nothrow&&copy_assign_nothrow)override final{
17141 if(this->is_unique()){
17142 _size-=size;
17143 self_changed();
17144 return this;
17145 }
17146 else
17147 return get<same_value_compress_string_data_t<char_T>>(_size-size,_value);
17148 }
17149 protected:
17150 virtual hash_t get_hash_detail(ptr_t&)noexcept(hash_nothrow)override final{
17151 return hash.repeat_times(_value,_size);
17152 }
17153 virtual hash_t get_others_hash_with_calculated_before_detail(hash_t before,size_t before_size,ptr_t&,[[maybe_unused]]size_t pos,size_t size)noexcept(hash_nothrow)override final{
17154 return hash.merge_array_hash_results(before,before_size,hash.repeat_times(_value,size),size);
17155 }
17156 protected:
17157 [[nodiscard]]virtual bool same_struct(ptr_t with)noexcept override final{
17158 return true;//总size被保证一样
17159 }
17160 [[nodiscard]]virtual range_t<const char_T*> get_the_largest_complete_data_block_begin_form([[maybe_unused]]size_t begin)noexcept override final{
17161 if constexpr(construct<char_T>.trivial<const char_T&> && destruct.trivial<char_T>){
17162 constexpr size_t data_size=512;
17163 static char_T data[data_size];
17164 if(data[0]!=_value)
17165 copy_assign[data_size](_value,note::to(data));
17166 return {data,note::size(min(_size-begin,data_size))};
17167 }
17168 else
17169 return {&_value,note::size<size_t>(1)};
17170 }
17171 [[nodiscard]]virtual bool same_struct_equal(ptr_t with)noexcept(equal.nothrow<char_T>)override final{
17172 auto wp=down_cast<this_t*>(with.get());
17173 return equal(_value,wp->_value);
17174 }
17175 [[nodiscard]]virtual base_t::compare_type same_struct_compare(ptr_t with)noexcept(compare.nothrow<char_T>)override final{
17176 auto wp=down_cast<this_t*>(with.get());
17177 return compare(_value,wp->_value);
17178 }
17179 [[nodiscard]]virtual float_size_t get_base_memory_cost()noexcept override final{
17180 return float_size_of(*this);
17181 }
17182 };
17183
17184 //file_end
17185
17186 #line 31 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/string_data_t/_body.hpp"
17187 }
17188
17189 //file_end
17190
17191 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/defs.hpp"
17192 template<typename char_T>
17193 struct string_t{
17194 static_assert(type_info<char_T> != type_info<const char_T>);
17195
17197 typedef base_t_w::ptr_t ptr_t;
17198 typedef base_t_w::string_view_t string_view_t;
17199 typedef const constexpr_str_t<char_T> constexpr_str_t;
17200 typedef string_t<char_T> this_t;
17201 typedef char_T value_type;
17202 typedef value_type char_type;
17203 typedef size_t size_type;
17204 static constexpr size_t npos = range_n::npos;
17205
17206 private:
17207 //_cso_info用于存储不同cso情况下string所用到的数据
17208 mutable union _cso_info_t{
17209 ptr_t _mptr;
17210 const constexpr_str_t* _str;
17211 char_T _ch;
17212
17213 push_and_disable_msvc_warning(26495);//未初始化警告diss
17214 constexpr _cso_info_t()noexcept{}
17215 constexpr _cso_info_t(const _cso_info_t&a)noexcept{
17216 copy_assign[sizeof(_cso_info_t)](cast_to_data(this),cast_to_data(&a));
17217 }
17218 pop_msvc_warning();
17219 constexpr void operator=(const _cso_info_t&a)noexcept{
17220 copy_assign[sizeof(_cso_info_t)](cast_to_data(this),cast_to_data(&a));
17221 }
17222 ~_cso_info_t()noexcept{}
17223 }_cso_info{};
17224 //_cso_flags用于标识不同的cso情况
17225 mutable struct _cso_flags_t{
17226 bool _cso_flag=0;
17227 bool _str_cso_flag=0;
17228 }_cso_flags;
17229
17230 //非cso情况下的成员宏,表示一个指向string data的智能指针
17231 #define _m _cso_info._mptr
17232
17233 //BLOCK: 对成员宏`_m`的生命周期手动管理的函数族
17234
17235 //结束成员宏`_m`的生命周期
17236 constexpr void _ncso_destruct_mptr()const noexcept{destruct(&_m);}
17237 //开始成员宏`_m`的生命周期
17238 constexpr void _ncso_construct_mptr()const noexcept{construct<ptr_t>[&_m]();}
17239 //以特定初始值开始成员宏`_m`的生命周期
17240 constexpr void _ncso_construct_mptr(ptr_t p)const noexcept{construct<ptr_t>[&_m](p);}
17241
17242 //END_BLOCK
17243
17244 //BLOCK: cso情况判断函数族
17245 [[nodiscard]]bool _in_cso()const noexcept{return _cso_flags._cso_flag;}
17246 [[nodiscard]]bool _in_str_cso()const noexcept{return _in_cso() && _cso_flags._str_cso_flag;}
17247 [[nodiscard]]bool _in_chr_cso()const noexcept{return _in_cso() && !_cso_flags._str_cso_flag;}
17248 //END_BLOCK
17249 //BLOCK: cso情况设定函数族
17250 constexpr void _set_str_cso()const noexcept{_cso_flags._cso_flag=1;_cso_flags._str_cso_flag=1;}
17251 constexpr void _set_chr_cso()const noexcept{_cso_flags._cso_flag=1;_cso_flags._str_cso_flag=0;}
17252 constexpr void _set_not_cso()const noexcept{_cso_flags._cso_flag=0;}
17253 //END_BLOCK
17254
17255 //BLOCK: cso情况下的信息获取函数族
17256 [[nodiscard]]const char_T* _get_cso_data()const noexcept{return _in_str_cso()?_cso_info._str->str():&_cso_info._ch;}
17257 [[nodiscard]]size_t _get_cso_size()const noexcept{return _in_str_cso()?_cso_info._str->size():1;}
17258 [[nodiscard]]hash_t _get_cso_hash()const noexcept{return _in_str_cso()?hash(_get_cso_constexpr_str()):hash(_cso_info._ch);}
17259 [[nodiscard]]constexpr_str_t& _get_cso_constexpr_str()const noexcept{return *_cso_info._str;}
17260 //END_BLOCK
17261
17262 //BLOCK: cso情况管理函数族
17263 constexpr void _cso_init(constexpr_str_t&str)noexcept{_set_str_cso();_cso_info._str=&str;}
17264 constexpr void _cso_reinit(constexpr_str_t&str)noexcept{if(!_in_cso())_ncso_destruct_mptr();_cso_init(str);}
17265 constexpr void _cso_init(char_T ch)noexcept{_set_chr_cso();_cso_info._ch=ch;}
17266 constexpr void _cso_reinit(char_T ch)noexcept{if(!_in_cso())_ncso_destruct_mptr();_cso_init(ch);}
17267 void _cso_fin(bool need_write)const noexcept{
17268 if(_in_str_cso()&&!need_write)
17269 _ncso_construct_mptr(get<constexpr_string_data_t<char_T>>(*_cso_info._str));
17270 else{
17271 auto str=string_view_t{_get_cso_data(),_get_cso_size()};
17272 _ncso_construct_mptr(get<comn_string_data_t<char_T>>(str));
17273 }
17274 _set_not_cso();
17275 }
17276 void _cso_fin(ptr_t p)noexcept{
17277 _set_not_cso();
17278 _ncso_construct_mptr(p);
17279 }
17280 //END_BLOCK
17281
17282 //BLOCK: 已知需要拷贝cso全部内容,判断是否值得结束cso的检查
17283 static constexpr bool the_size_worth_to_end_cso(size_t size)noexcept{
17284 constexpr auto max_size=max(sizeof(comn_string_data_t<char_T>)*2/sizeof(char_T),(size_t)1);
17285 return size>=max_size;
17286 }
17287 static void full_copy_cso_check(const string_t&str)noexcept{
17288 if(the_size_worth_to_end_cso(str.size()))
17289 str._cso_check();
17290 }
17291 //END_BLOCK
17292
17293 //若cso,结束它
17294 void _cso_check(bool need_write=0)const noexcept{
17295 if(_in_cso())
17296 _cso_fin(need_write);
17297 }
17298
17299 //便利用,内部使用的构造函数
17300 string_t(ptr_t str)noexcept{_ncso_construct_mptr(str);}
17301 //无论是否在cso中,都保证可以获得一个ptr
17302 [[nodiscard]]ptr_t ptr_copy()const noexcept{
17303 _cso_check();
17304 return _m;
17305 }
17306 public:
17307 //swap的内部实现
17308 void swap_with(this_t& a)noexcept{
17309 if(_in_cso()||a._in_cso()){
17310 swap(_cso_info,a._cso_info);
17311 swap(_cso_flags,a._cso_flags);
17312 }
17313 else
17314 swap(_m,a._m);
17315 }
17316
17317 //BLOCK: 构造函数
17318 constexpr string_t()noexcept:string_t(empty_constexpr_str_of<char_T>){}
17319 constexpr string_t(constexpr_str_t&str)noexcept{_cso_init(str);}
17320 string_t(string_view_t str)noexcept{_ncso_construct_mptr(get<comn_string_data_t<char_T>>(str));}
17321 string_t(const char_T* str)noexcept:string_t(string_view_t(str)){}
17322 constexpr string_t(char_T ch)noexcept{_cso_init(ch);}
17323 string_t(const string_t& str)noexcept{
17324 if(str._in_cso()){
17325 _cso_info=str._cso_info;
17326 _cso_flags=str._cso_flags;
17327 }
17328 else
17329 _ncso_construct_mptr(str._m);
17330 }
17331 string_t(string_t&& str)noexcept:string_t(){
17332 swap_with(str);
17333 }
17334 string_t(size_t size,char_T ch)noexcept{_ncso_construct_mptr(get<same_value_compress_string_data_t<char_T>>(size,ch));}
17335 string_t(char_T ch,size_t size)noexcept requires(type_info<size_t>!=type_info<char_T>):string_t(size,ch){}
17336
17337 string_t(size_t size)noexcept{_ncso_construct_mptr(get<comn_string_data_t<char_T>>(size));}
17338 //END_BLOCK
17339 //析构函数
17340 ~string_t()noexcept{if(!_in_cso())_ncso_destruct_mptr();}
17341
17342 //BLOCK: 赋值操作符
17343 string_t& operator=(const string_t& str)noexcept{re_construct[this](str);return*this;}
17344 string_t& operator=(string_t&& str)noexcept{swap_with(str);return*this;}
17345 constexpr string_t& operator=(constexpr_str_t&str)noexcept{_cso_reinit(str);return*this;}
17346 constexpr string_t& operator=(char_T ch)noexcept{_cso_reinit(ch);return*this;}
17347 //END_BLOCK
17348
17349 //BLOCK: 字符串相加操作符
17350 [[nodiscard]]string_t operator+(const string_t& str)const noexcept{
17351 full_copy_cso_check(str);
17352 if(str._in_cso())
17353 return operator+(str.to_string_view_t());
17354 else
17355 return ptr_copy()->apply_str_to_end(str._m);
17356 }
17357 [[nodiscard]]string_t operator+(string_view_t str)const noexcept{
17358 return ptr_copy()->apply_str_to_end(str);
17359 }
17360 [[nodiscard]]string_t operator+(const char_T* str)const noexcept{
17361 return *this+string_view_t(str);
17362 }
17363 friend [[nodiscard]]string_t operator+(string_view_t str1,const string_t& str2)noexcept{
17364 return str2.ptr_copy()->apply_str_to_begin(str1);
17365 }
17366 friend [[nodiscard]]string_t operator+(const char_T* str1,const string_t& str2)noexcept{
17367 return string_view_t(str1)+str2;
17368 }
17369 friend [[nodiscard]]string_t operator+(char_T ch,const string_t& str)noexcept{
17370 return string_view_t{&ch,1}+str;
17371 }
17372
17373 string_t& operator+=(const string_t&str)&noexcept{
17374 push_back(str);
17375 return *this;
17376 }
17377 string_t& operator+=(string_view_t str)&noexcept{
17378 push_back(str);
17379 return *this;
17380 }
17381 string_t& operator+=(const char_T* str)&noexcept{
17382 return *this+=string_view_t(str);
17383 }
17384 string_t& operator+=(char_T ch)&noexcept{
17385 return *this += string_view_t{&ch,1};
17386 }
17387 template<typename U>
17388 [[nodiscard]]string_t&& operator+(U&& b)&&noexcept_as(*this+=b) requires was_not_an_ill_form(*this+=b){ //对右值的operator+优化为operator+=
17389 *this+=b;
17390 return move(*this);
17391 }
17392 //END_BLOCK
17393
17394 //获取string占用的内存大小
17395 float_size_t memory_cost()const noexcept{
17396 if(_in_cso())
17397 return 0;
17398 else
17399 return _m->get_memory_cost();
17400 }
17401 public:
17402 //BLOCK: 比较运算符
17403 [[nodiscard]]constexpr auto operator<=>(const string_t& a)const noexcept(compare.nothrow<char_T>){
17404 if(a._in_str_cso())
17405 return operator<=>(a._get_cso_constexpr_str());
17406 elseif(a._in_cso())
17407 return operator<=>(a.to_string_view_t());
17408 auto ssize = size();
17409 auto scom = compare(ssize,a.size());//先比较大小,若需要再调用data
17410 if(scom==0){//大小相等
17411 if(!_in_cso())
17412 return _m->compare_with(a._m);
17413 elseif(_in_str_cso())
17414 return compare.reverse(a<=>_get_cso_constexpr_str());
17415 elseif(_in_cso())
17416 return compare.reverse(a<=>to_string_view_t());
17417 }
17418 return scom;
17419 }
17420 [[nodiscard]]constexpr auto operator==(const string_t& a)const noexcept(equal.nothrow<char_T>){
17421 if(a._in_str_cso())
17422 return operator==(a._get_cso_constexpr_str());
17423 elseif(a._in_cso())
17424 return operator==(a.to_string_view_t());
17425 auto ssize = size();
17426 const auto seq = equal(ssize,a.size());//先比较大小,若需要再调用data
17427 if(seq){//大小相等
17428 if(!_in_cso())
17429 return _m->equal_with(a._m);
17430 elseif(_in_str_cso())
17431 return a==_get_cso_constexpr_str();
17432 elseif(_in_cso())
17433 return a==to_string_view_t();
17434 }
17435 return seq;
17436 }
17437 [[nodiscard]]constexpr auto operator<=>(string_view_t a)const noexcept(compare.nothrow<char_T>){
17438 auto ssize = size();
17439 auto scom = compare(ssize,a.size());//先比较大小,若需要再调用data
17440 if(scom==0){
17441 if(_in_cso())
17442 return compare(data(),a.begin(),ssize);
17443 else
17444 return _m->compare_with(a);
17445 }
17446 return scom;
17447 }
17448 [[nodiscard]]constexpr auto operator==(string_view_t a)const noexcept(equal.nothrow<char_T>){
17449 auto ssize = size();
17450 const auto seq = equal(ssize,a.size());//先比较大小,若需要再调用data
17451 if(seq){
17452 if(_in_cso())
17453 return equal(data(),a.begin(),ssize);
17454 else
17455 return _m->equal_with(a);
17456 }
17457 return seq;
17458 }
17459 [[nodiscard]]constexpr auto operator<=>(constexpr_str_t&a)const noexcept(compare.nothrow<char_T>){
17460 if(_in_cso() && data()==a.str())//同起始优化
17461 return strong_ordering::equivalent;
17462 auto tmp=operator<=>((string_view_t&)a);
17463 if(tmp==0)
17464 remove_const(this)->_cso_reinit(a);
17465 return tmp;
17466 }
17467 [[nodiscard]]constexpr auto operator==(constexpr_str_t&a)const noexcept(equal.nothrow<char_T>){
17468 if(_in_cso() && data()==a.str())//同起始优化
17469 return true;
17470 const auto tmp=operator==((string_view_t&)a);
17471 if(tmp)
17472 remove_const(this)->_cso_reinit(a);
17473 return tmp;
17474 }
17475 [[nodiscard]]constexpr auto operator<=>(const char_T* a)const noexcept(compare.nothrow<char_T>){
17476 if(_in_cso())
17477 return compare(data(),size(),a,end_by_zero);
17478 else
17479 return _m->compare_with(a);
17480 }
17481 [[nodiscard]]constexpr auto operator==(const char_T* a)const noexcept(equal.nothrow<char_T>){
17482 if(_in_cso())
17483 return equal(data(),size(),a,end_by_zero);
17484 else
17485 return _m->equal_with(a);
17486 }
17487 //END_BLOCK
17488 private:
17489 [[nodiscard]]char_T* unique_c_str()noexcept{ _cso_check(1);return _m->get_unique_c_str(_m); }
17490 public:
17491 [[nodiscard]]char_T arec(size_t index)noexcept{
17492 if(_in_cso())
17493 return _get_cso_data()[index];
17494 else
17495 return _m->arec(index);
17496 }
17497 void arec_set(size_t index,char_T a)noexcept{ _cso_check(1);return _m->arec_set(index,a,_m); }
17498
17500 string_t* _to;
17501 size_t _index;
17502
17503 friend class string_t;
17504 public:
17505 arec_t(string_t* to,size_t index)noexcept:_to(to),_index(index){}
17506 arec_t(special_init_t,const arec_t&ref)noexcept:_to(ref._to),_index(ref._index){}
17507 [[nodiscard]]operator char_T()const&&noexcept{ return _to->arec(_index); }
17508 arec_t&& operator=(char_T a)&&noexcept{
17509 _to->arec_set(_index,a);
17510 return move(*this);
17511 }
17512 arec_t&& operator=(const arec_t&&ch)&&noexcept{ return move(*this).operator=(move(ch).operator char_T()); }
17513 private:
17514 [[nodiscard]]char_T* get_address()noexcept{ return _to->unique_c_str()+_index; }
17515 [[nodiscard]]const char_T* get_address()const noexcept{ return (add_const(_to))->c_str()+_index; }
17516 public:
17517 [[nodiscard]]char_T* operator&()&&noexcept{ return get_address(); }
17518 [[nodiscard]]const char_T* operator&()const&&noexcept{ return get_address(); }
17519 /*
17520 [[nodiscard]]explicit operator char_T&()&&noexcept{ return *get_address(); }
17521 [[nodiscard]]explicit operator const char_T&()const&&noexcept{ return *get_address(); }
17522 */
17523 };
17524
17525 [[nodiscard]]arec_t operator[](size_t index)noexcept{ return{this,index}; }
17526 [[nodiscard]]const arec_t operator[](size_t index)const noexcept{ return{remove_const(this),index}; }
17527
17528 //front
17529 [[nodiscard]]arec_t front()noexcept{ return{this,0}; }
17530 [[nodiscard]]const arec_t front()const noexcept{ return{remove_const(this),0}; }
17531 //back
17532 [[nodiscard]]arec_t back()noexcept{ return{this,size()-1}; }
17533 [[nodiscard]]const arec_t back()const noexcept{ return{remove_const(this),size()-1}; }
17534
17535
17536 [[nodiscard]]string_t operator+(const arec_t&& ch)const noexcept{
17537 return *this+move(ch).operator char_T();
17538 }
17539 string_t& operator+=(const arec_t&& ch)&noexcept{
17540 return *this+=move(ch).operator char_T();
17541 }
17542
17543 //floating arec.
17544 private:
17545 static constexpr bool floating_arec_result_able=was_not_an_ill_form(
17546 magic_number::linear_interpolation::get_result(declvalue(size_t),
17547 magic_number::linear_interpolation::get_k(declvalue(char_T),declvalue(char_T)),
17548 declvalue(float_t))
17549 );
17550 static auto floating_arec_result_type_helper()noexcept{
17551 if constexpr(floating_arec_result_able)
17552 return magic_number::linear_interpolation::get_result(size_t{},
17553 magic_number::linear_interpolation::get_k(char_T{},char_T{}),
17554 float_t{});
17555 }
17556 typedef decltype(floating_arec_result_type_helper()) floating_arec_result_type;
17557 static constexpr bool floating_arec_set_able=was_not_an_ill_form(
17558 magic_number::linear_interpolation::get_reverse_result(
17559 magic_number::linear_interpolation::get_k(declvalue(char_T),declvalue(char_T)),
17560 declvalue(float_t),declvalue(char_T))
17561 );
17562 public:
17563 static constexpr bool floating_arec_able=floating_arec_result_able||floating_arec_set_able;
17565 string_t* _to;
17566 float_t _index;
17567 size_t _index_x1;
17568 size_t _index_x2;
17569
17570 friend class string_t;
17571 public:
17572 static constexpr bool result_able=floating_arec_result_able;
17573 static constexpr bool set_able=floating_arec_set_able;
17574
17575 floating_arec_t(string_t* to,float_t index)noexcept:_to(to),_index(index){
17576 _index_x1=static_cast<size_t>(index);
17577 _index_x2=_index_x1+1;
17578 }
17579 floating_arec_t(special_init_t,const floating_arec_t&ref)noexcept:_to(ref._to),_index(ref._index){}
17580 [[nodiscard]]operator floating_arec_result_type()const&&noexcept requires result_able{
17581 char_T y1=_to->arec(_index_x1);
17582 char_T y2=_to->arec(_index_x2);
17583 auto δx=_index-_index_x1;
17584 return magic_number::linear_interpolation::get_result(y1,
17585 magic_number::linear_interpolation::get_k(y1,y2),
17586 δx);
17587 }
17588 floating_arec_t&& operator=(floating_arec_result_type a)&&noexcept requires set_able{
17589 char_T y1=_to->arec(_index_x1);
17590 char_T y2=_to->arec(_index_x2);
17591 auto k=magic_number::linear_interpolation::get_k(y1,y2);
17592 auto δx1=_index-_index_x1;
17593 auto δx2=_index-_index_x2;
17594 y1=(char_T)magic_number::linear_interpolation::get_reverse_result(k,δx1,a);
17595 y2=(char_T)magic_number::linear_interpolation::get_reverse_result(k,δx2,a);
17596 _to->arec_set(_index_x1,y1);
17597 _to->arec_set(_index_x2,y2);
17598 return move(*this);
17599 }
17600 };
17601 [[nodiscard]]floating_arec_t operator[](float_t index)noexcept requires(floating_arec_able){ return{this,index}; }
17602 [[nodiscard]]const floating_arec_t operator[](float_t index)const noexcept requires(floating_arec_able){ return{remove_const(this),index}; }
17603
17604 //泛型arec.
17605 template<typename T> requires ::std::is_arithmetic_v<T>
17606 [[nodiscard]]auto operator[](T index)noexcept{
17607 if constexpr(::std::is_floating_point_v<T>)
17608 return operator[](static_cast<float_t>(index));
17609 else
17610 return operator[](static_cast<size_t>(index));
17611 }
17612 template<typename T> requires ::std::is_arithmetic_v<T>
17613 [[nodiscard]]const auto operator[](T index)const noexcept{
17614 if constexpr(::std::is_floating_point_v<T>)
17615 return operator[](static_cast<float_t>(index));
17616 else
17617 return operator[](static_cast<size_t>(index));
17618 }
17619
17620 [[nodiscard]]string_t substr(size_t begin,size_t size=npos)const noexcept{
17621 size=min(size,this->size()-begin);
17622 if(size){
17623 _cso_check();
17624 return _m->get_substr_data(begin,size);
17625 }
17626 else
17627 return {};
17628 }
17629 [[nodiscard]]const char_T* data()const noexcept{ if(_in_cso())return _get_cso_data();else return _m->get_data(_m); }
17630 [[nodiscard]]char_T* writeable_data()noexcept{ return unique_c_str(); }
17631 [[nodiscard]]const char_T* c_str()const noexcept{ if(_in_cso())return _get_cso_data();else return _m->get_const_c_str(_m); }
17632 [[nodiscard]]char_T* writeable_c_str()noexcept{ return unique_c_str(); }
17633 [[nodiscard]]size_t size()const noexcept{ if(_in_cso())return _get_cso_size();else return _m->get_size(); }
17634 [[nodiscard]]explicit operator bool()const noexcept{ return size(); }
17635 [[nodiscard]]bool empty()const noexcept{ return !size(); }
17636 [[nodiscard]]size_t length()const noexcept{ return size(); }
17637 void resize(size_t nsize,char_T ch)noexcept{
17638 const auto size=this->size();
17639 if(size > nsize)
17640 *this=substr(0,nsize);
17641 elseif(size == nsize)
17642 return;
17643 elseif(size){
17644 _cso_check();
17645 _m=get<end_apply_string_data_t<char_T>>(_m,nsize-size,ch);
17646 }
17647 else
17648 *this=string_t{nsize,ch};
17649 }
17650 void resize(size_t nsize)noexcept{
17651 const auto size=this->size();
17652 if(size > nsize)
17653 *this=substr(0,nsize);
17654 elseif(size == nsize)
17655 return;
17656 elseif(size){
17657 _cso_check();
17658 _m=get<end_apply_string_data_t<char_T>>(_m,nsize-size);
17659 }
17660 else
17661 *this=string_t{nsize};
17662 }
17663 void clear()noexcept{ re_construct(this); }
17664 private:
17665 struct iterator_base_t{
17666 string_t* _to;
17667 ptrdiff_t _index; //rend: -1,使用size_t也不是不可以(标准允许无符号整数溢出),但是operator<=>会出问题
17668
17669 [[nodiscard]]constexpr iterator_base_t get_before()const noexcept{ return{_to,_index-1}; }
17670 [[nodiscard]]constexpr iterator_base_t get_next()const noexcept{ return{_to,_index+1}; }
17671 [[nodiscard]]arec_t get_value()noexcept{ return (*_to)[_index]; }
17672 [[nodiscard]]const arec_t get_value()const noexcept{ return (*add_const(_to))[_index]; }
17673 [[nodiscard]]char_T* get_handle()noexcept{ return &get_value(); }
17674 [[nodiscard]]const char_T* get_handle()const noexcept{ return &get_value(); }
17675 [[nodiscard]]constexpr bool operator==(const iterator_base_t& a)const noexcept{ return _to==a._to && _index==a._index; }
17676 [[nodiscard]]constexpr auto operator<=>(const iterator_base_t& a)const noexcept{ return _to==a._to ? _index<=>a._index : partial_ordering::unordered; }
17677 };
17678 [[nodiscard]]iterator_base_t get_iterator_data_at(ptrdiff_t index)const noexcept{ return iterator_base_t{(string_t*)this,index}; }
17679 public:
17680 typedef iterator_t<char_T,iterator_base_t> iterator;
17681 typedef const_iterator_t<char_T,const iterator_base_t> const_iterator;
17682
17683 [[nodiscard]]iterator get_iterator_at(ptrdiff_t index)noexcept{ return get_iterator_data_at(index); }
17684 [[nodiscard]]const_iterator get_iterator_at(ptrdiff_t index)const noexcept{ return get_iterator_data_at(index); }
17685 [[nodiscard]]iterator begin()noexcept{ return get_iterator_at(0); }
17686 [[nodiscard]]const_iterator begin()const noexcept{ return get_iterator_at(0); }
17687 [[nodiscard]]const_iterator cbegin()const noexcept{ return begin(); }
17688 [[nodiscard]]iterator end()noexcept{ return get_iterator_at(size()); }
17689 [[nodiscard]]const_iterator end()const noexcept{ return get_iterator_at(size()); }
17690 [[nodiscard]]const_iterator cend()const noexcept{ return end(); }
17691
17692 typedef reverse_iterator_t<char_T,iterator_base_t> reverse_iterator;
17693 typedef reverse_const_iterator_t<char_T,const iterator_base_t> reverse_const_iterator;
17694
17695 [[nodiscard]]reverse_iterator get_reverse_iterator_at(ptrdiff_t index)noexcept{ return get_iterator_data_at(index); }
17696 [[nodiscard]]reverse_const_iterator get_reverse_iterator_at(ptrdiff_t index)const noexcept{ return get_iterator_data_at(index); }
17697 [[nodiscard]]reverse_iterator rbegin()noexcept{ return get_reverse_iterator_at(size()-1); }
17698 [[nodiscard]]reverse_const_iterator rbegin()const noexcept{ return get_reverse_iterator_at(size()-1); }
17699 [[nodiscard]]reverse_const_iterator rcbegin()const noexcept{ return rbegin(); }
17700 [[nodiscard]]reverse_iterator rend()noexcept{ return get_reverse_iterator_at(-1); }
17701 [[nodiscard]]reverse_const_iterator rend()const noexcept{ return get_reverse_iterator_at(-1); }
17702 [[nodiscard]]reverse_const_iterator rcend()const noexcept{ return rend(); }
17703
17704 //
17705
17706 void push_back(const string_t& str)&noexcept{
17707 full_copy_cso_check(*this);
17708 full_copy_cso_check(str);
17709 if(_in_cso()&&!str._in_cso())
17710 _cso_fin(str._m->apply_str_to_begin(to_string_view_t()));
17711 elseif(str._in_cso()){
17712 push_back(str.to_string_view_t());
17713 }
17714 else{
17715 _cso_check();
17716 _m=_m->apply_str_to_end(str._m);
17717 }
17718 }
17719 void push_back(string_view_t str)&noexcept{ _cso_check();_m=_m->apply_str_to_end(str); }
17720 void push_back(char_T ch)&noexcept{ push_back(string_view_t{&ch,1}); }
17721 void push_back(const arec_t&& ch)&noexcept{ push_back(move(ch).operator char_T()); }
17722 void push_back(const char_T* str)&noexcept{ push_back(string_view_t(str)); }
17723
17724 void push_front(const string_t& str)&noexcept{
17725 full_copy_cso_check(*this);
17726 full_copy_cso_check(str);
17727 if(_in_cso()&&!str._in_cso())
17728 _cso_fin(str._m->apply_str_to_end(to_string_view_t()));
17729 elseif(str._in_cso()){
17730 push_front(str.to_string_view_t());
17731 }
17732 else{
17733 _cso_check();
17734 _m=_m->apply_str_to_begin(str._m);
17735 }
17736 }
17737 void push_front(string_view_t str)&noexcept{ _cso_check();_m=_m->apply_str_to_begin(str); }
17738 void push_front(char_T ch)&noexcept{ push_front(string_view_t{&ch,1}); }
17739 void push_front(const arec_t&& ch)&noexcept{ push_front(move(ch).operator char_T()); }
17740 void push_front(const char_T* str)&noexcept{ push_front(string_view_t(str)); }
17741
17742 string_t pop_back(size_t size)noexcept{ _cso_check();return _m->do_pop_back(size,_m); }
17743 string_t pop_front(size_t size)noexcept{ _cso_check();return _m->do_pop_front(size,_m); }
17744 char_T pop_back()noexcept{ return pop_back(1)[0]; }
17745 char_T pop_front()noexcept{ return pop_front(1)[0]; }
17746
17747 //
17748
17749 [[nodiscard]]operator string_view_t()const&noexcept{ return string_view_t{data(),size()}; }
17750 [[nodiscard]]auto to_string_view_t()const&noexcept{ return operator string_view_t(); }
17751 [[nodiscard]]auto view()&noexcept{ return array_like_view_t<char_T>{writeable_data(),size()}; }
17752 [[nodiscard]]auto view()const&noexcept{ return array_like_view_t<const char_T>{data(),size()}; }
17753 [[nodiscard]]explicit operator hash_t()const noexcept{ return _in_cso()?_get_cso_hash():_m->get_hash(_m); }
17754
17755 //
17756 static constexpr bool find_nothrow=equal.nothrow<char_T>;
17757 [[nodiscard]]size_t find(const char_T ch,size_t begin=0)const noexcept(find_nothrow){
17758 return in_range_size_t(ch, to_string_view_t().substr(begin));
17759 }
17760 [[nodiscard]]size_t reverse_find(const char_T ch)const noexcept(find_nothrow){
17761 return in_range_but_reverse_size_t(ch, to_string_view_t());
17762 }
17763 [[nodiscard]]size_t find(string_view_t str,size_t begin=0)const noexcept(find_nothrow){
17764 return in_range_size_t(str, to_string_view_t().substr(begin));
17765 }
17766 [[nodiscard]]size_t reverse_find(string_view_t str)const noexcept(find_nothrow){
17767 return in_range_but_reverse_size_t(str, to_string_view_t());
17768 }
17769 [[nodiscard]]size_t find(constexpr_str_t&str,size_t begin=0)const noexcept(find_nothrow){
17770 return in_range_size_t(str, to_string_view_t().substr(begin));
17771 }
17772 [[nodiscard]]size_t reverse_find(constexpr_str_t&str)const noexcept(find_nothrow){
17773 return in_range_but_reverse_size_t(str, to_string_view_t());
17774 }
17775 [[nodiscard]]size_t find(const string_t&str,size_t begin=0)const noexcept(find_nothrow){
17776 if(str._in_cso()){
17777 if(str._in_str_cso())
17778 return find(str._get_cso_constexpr_str(),begin);
17779 elseif(str._in_cso())
17780 return find(str._cso_info._ch,begin);
17781 }
17782 auto result = str._m->get_match_pattern_from_self(str._m).match(to_string_view_t().substr(begin));
17783 if(result)
17784 return result - data();
17785 else
17786 return npos;
17787 }
17788 [[nodiscard]]size_t reverse_find(const string_t&str)const noexcept(find_nothrow){
17789 if(str._in_cso()){
17790 if(str._in_str_cso())
17791 return reverse_find(str._get_cso_constexpr_str());
17792 elseif(str._in_cso())
17793 return reverse_find(str._cso_info._ch);
17794 }
17795 auto result = str._m->get_reverse_match_pattern_from_self(str._m).match(to_string_view_t());
17796 if(result)
17797 return result - data();
17798 else
17799 return npos;
17800 }
17801 //
17802 [[nodiscard]]size_t find_first_of(string_view_t str)const noexcept(find_nothrow){
17803 return range_n::find_first_of_size_t(str,to_string_view_t());
17804 }
17805 [[nodiscard]]size_t find_first_of(constexpr_str_t&str)const noexcept(find_nothrow){
17806 return range_n::find_first_of_size_t(str,to_string_view_t());
17807 }
17808 [[nodiscard]]size_t find_first_of(const string_t&str)const noexcept(find_nothrow){
17809 if(str._in_cso()){
17810 if(str._in_str_cso())
17811 return find_first_of(str._get_cso_constexpr_str());
17812 elseif(str._in_cso())
17813 return find(str._cso_info._ch);
17814 }
17815 return find_first_of(str.to_string_view_t());
17816 }
17817 [[nodiscard]]size_t find_first_of(const char_T*str)const noexcept(find_nothrow){
17818 return find_first_of(string_view_t(str));
17819 }
17820 [[nodiscard]]size_t find_first_of(char_T ch)const noexcept(find_nothrow){
17821 return find(ch);
17822 }
17823 [[nodiscard]]size_t find_first_of(const arec_t&&ch)const noexcept(find_nothrow){
17824 return find(move(ch).operator char_T());
17825 }
17826 [[nodiscard]]size_t find_first_not_of(string_view_t str)const noexcept(find_nothrow){
17827 return range_n::find_first_not_of_size_t(str,to_string_view_t());
17828 }
17829 [[nodiscard]]size_t find_first_not_of(constexpr_str_t&str)const noexcept(find_nothrow){
17830 return range_n::find_first_not_of_size_t(str,to_string_view_t());
17831 }
17832 [[nodiscard]]size_t find_first_not_of(const string_t&str)const noexcept(find_nothrow){
17833 if(str._in_cso()){
17834 if(str._in_str_cso())
17835 return find_first_not_of(str._get_cso_constexpr_str());
17836 elseif(str._in_cso())
17837 return find_first_not_of(str.to_string_view_t());
17838 }
17839 return find_first_not_of(str.to_string_view_t());
17840 }
17841 [[nodiscard]]size_t find_first_not_of(const char_T*str)const noexcept(find_nothrow){
17842 return find_first_not_of(string_view_t(str));
17843 }
17844 [[nodiscard]]size_t find_first_not_of(char_T ch)const noexcept(find_nothrow){
17845 return find_first_not_of(string_view_t(ch));
17846 }
17847 [[nodiscard]]size_t find_first_not_of(const arec_t&&ch)const noexcept(find_nothrow){
17848 return find_first_not_of(string_view_t(move(ch).operator char_T()));
17849 }
17850 [[nodiscard]]size_t find_last_of(string_view_t str)const noexcept(find_nothrow){
17851 return range_n::find_last_of_size_t(str,to_string_view_t());
17852 }
17853 [[nodiscard]]size_t find_last_of(constexpr_str_t&str)const noexcept(find_nothrow){
17854 return range_n::find_last_of_size_t(str,to_string_view_t());
17855 }
17856 [[nodiscard]]size_t find_last_of(const string_t&str)const noexcept(find_nothrow){
17857 if(str._in_cso()){
17858 if(str._in_str_cso())
17859 return find_last_of(str._get_cso_constexpr_str());
17860 elseif(str._in_cso())
17861 return reverse_find(str._cso_info._ch);
17862 }
17863 return find_last_of(str.to_string_view_t());
17864 }
17865 [[nodiscard]]size_t find_last_of(const char_T*str)const noexcept(find_nothrow){
17866 return find_last_of(string_view_t(str));
17867 }
17868 [[nodiscard]]size_t find_last_of(char_T ch)const noexcept(find_nothrow){
17869 return reverse_find(ch);
17870 }
17871 [[nodiscard]]size_t find_last_of(const arec_t&&ch)const noexcept(find_nothrow){
17872 return reverse_find(move(ch).operator char_T());
17873 }
17874 [[nodiscard]]size_t find_last_not_of(string_view_t str)const noexcept(find_nothrow){
17875 return range_n::find_last_not_of_size_t(str,to_string_view_t());
17876 }
17877 [[nodiscard]]size_t find_last_not_of(constexpr_str_t&str)const noexcept(find_nothrow){
17878 return range_n::find_last_not_of_size_t(str,to_string_view_t());
17879 }
17880 [[nodiscard]]size_t find_last_not_of(const string_t&str)const noexcept(find_nothrow){
17881 if(str._in_cso()){
17882 if(str._in_str_cso())
17883 return find_last_not_of(str._get_cso_constexpr_str());
17884 elseif(str._in_cso())
17885 return find_last_not_of(str.to_string_view_t());
17886 }
17887 return find_last_not_of(str.to_string_view_t());
17888 }
17889 [[nodiscard]]size_t find_last_not_of(const char_T*str)const noexcept(find_nothrow){
17890 return find_last_not_of(string_view_t(str));
17891 }
17892 [[nodiscard]]size_t find_last_not_of(char_T ch)const noexcept(find_nothrow){
17893 return find_last_not_of(string_view_t{&ch,1});
17894 }
17895 [[nodiscard]]size_t find_last_not_of(const arec_t&&ch)const noexcept(find_nothrow){
17896 return find_last_not_of(move(ch).operator char_T());
17897 }
17898
17899 //
17900
17901 [[nodiscard]]string_t arec(size_t index,char_T delimiter)const{
17902 auto pos=find(delimiter);
17903 auto end=find(delimiter,pos);
17904 while(index--){
17905 pos=end;
17906 end=find(delimiter,pos);
17907 }
17908 return substr(pos,end-pos);
17909 }
17910 [[nodiscard]]string_t arec(size_t index,string_view_t delimiter_str)const{
17911 auto pos=find(delimiter_str);
17912 auto end=find(delimiter_str,pos);
17913 while(index--){
17914 pos=end;
17915 end=find(delimiter_str,pos);
17916 }
17917 return substr(pos,end-pos);
17918 }
17919 [[nodiscard]]string_t arec(size_t index,const string_t&delimiter_str)const{
17920 auto pos=find(delimiter_str);
17921 auto end=find(delimiter_str,pos);
17922 while(index--){
17923 pos=end;
17924 end=find(delimiter_str,pos);
17925 }
17926 return substr(pos,end-pos);
17927 }
17928 [[nodiscard]]string_t arec(size_t index,constexpr_str_t&delimiter_str)const{
17929 auto pos=find(delimiter_str);
17930 auto end=find(delimiter_str,pos);
17931 while(index--){
17932 pos=end;
17933 end=find(delimiter_str,pos);
17934 }
17935 return substr(pos,end-pos);
17936 }
17937
17938 //
17939
17940 void erase(size_t pos,size_t size=1)&noexcept{
17941 _cso_check();_m=_m->do_erase(pos,size);
17942 }
17943 void insert(size_t pos,const string_t& str)&noexcept{
17944 _cso_check();
17945 full_copy_cso_check(str);
17946 if(str._in_cso())
17947 _m=_m->do_insert(pos,str.to_string_view_t());
17948 else
17949 _m=_m->do_insert(pos,str);
17950 }
17951 void insert(size_t pos,string_view_t str)&noexcept{
17952 _cso_check();_m=_m->do_insert(pos,str);
17953 }
17954 void insert(size_t pos,const char_T* str)&noexcept{
17955 insert(pos,string_view_t(str));
17956 }
17957 void insert(size_t pos,char_T ch)&noexcept{
17958 insert(pos,string_view_t{&ch,1});
17959 }
17960
17961 //
17962
17963 //contains
17964 constexpr bool contains(string_view_t str)const noexcept{
17965 return find(str) != npos;
17966 }
17967 constexpr bool contains(constexpr_str_t&str)const noexcept{
17968 return find(str) != npos;
17969 }
17970 constexpr bool contains(const string_t&str)const noexcept{
17971 return find(str) != npos;
17972 }
17973 constexpr bool contains(char_T ch)const noexcept{
17974 return find(ch) != npos;
17975 }
17976 constexpr bool contains(const char_T*str)const noexcept{
17977 return find(str) != npos;
17978 }
17979
17980 //starts_with
17981 constexpr bool starts_with(string_view_t str)const noexcept{
17982 if(size()<str.size())
17983 return false;
17984 return substr(0,str.size()) == str;
17985 }
17986 constexpr bool starts_with(constexpr_str_t&str)const noexcept{
17987 if(size()<str.size())
17988 return false;
17989 return substr(0,str.size()) == str;
17990 }
17991 constexpr bool starts_with(const string_t&str)const noexcept{
17992 if(size()<str.size())
17993 return false;
17994 if(str._in_chr_cso())
17995 return starts_with(str._cso_info._ch);
17996 else
17997 return substr(0,str.size()) == str;
17998 }
17999 constexpr bool starts_with(char_T ch)const noexcept{
18000 if(size()<1)
18001 return false;
18002 return operator[](0) == ch;
18003 }
18004 constexpr bool starts_with(const char_T*str)const noexcept{
18005 return starts_with(string_view_t{str});
18006 }
18007
18008 //ends_with
18009 constexpr bool ends_with(string_view_t str)const noexcept{
18010 if(size()<str.size())
18011 return false;
18012 return substr(size()-str.size()) == str;
18013 }
18014 constexpr bool ends_with(constexpr_str_t&str)const noexcept{
18015 if(size()<str.size())
18016 return false;
18017 return substr(size()-str.size()) == str;
18018 }
18019 constexpr bool ends_with(const string_t&str)const noexcept{
18020 if(size()<str.size())
18021 return false;
18022 if(str._in_chr_cso())
18023 return ends_with(str._cso_info._ch);
18024 else
18025 return substr(size()-str.size()) == str;
18026 }
18027 constexpr bool ends_with(char_T ch)const noexcept{
18028 if(size()<1)
18029 return false;
18030 return operator[](size()-1) == ch;
18031 }
18032 constexpr bool ends_with(const char_T*str)const noexcept{
18033 return ends_with(string_view_t{str});
18034 }
18035
18036 this_t& append(size_t size,char_T ch)noexcept{
18037 return *this+=string_t{size,ch};
18038 }
18039 /*
18040 compare
18041 replace
18042 */
18043 #undef _m
18044 };
18045
18046 //推导指引
18047 template<class char_T>
18048 string_t(const char_T*) -> string_t<char_T>;
18049 template<class char_T>
18050 string_t(char_T*) -> string_t<char_T>;
18051
18052 //string的swap特化
18053 template<typename T>
18054 inline void swap(string_t<T>& a,string_t<T>& b)noexcept{ a.swap_with(b); }
18055
18056 //std ostream支持
18057 template<typename some_fucking_std_ostream, typename T>
18058 decltype(auto) operator<<(some_fucking_std_ostream& stream, const string_t<T>& str){
18059 typedef some_fucking_std_ostream stream_t;
18060 typedef stream_t::traits_type traits_t;
18061 typename stream_t::iostate state = stream_t::goodbit;
18062
18063 suppress_msvc_warning(26494);//未初始化警告diss
18064 size_t pad;
18065 size_t size = str.size();
18066 if(stream.width() <= 0 || static_cast<size_t>(stream.width()) <= size)
18067 pad = 0;
18068 else
18069 pad = static_cast<size_t>(stream.width()) - size;
18070
18071 const typename stream_t::sentry isok(stream);
18072
18073 if(!isok)
18074 state |= stream_t::badbit;
18075 else {
18076 try {
18077 if((stream.flags() & stream_t::adjustfield) != stream_t::left){
18078 for(; 0 < pad; --pad){ // pad on left
18079 if(traits_t::eq_int_type(traits_t::eof(), stream.rdbuf()->sputc(stream.fill()))){
18080 state |= stream_t::badbit; // insertion failed, quit
18081 break;
18082 }
18083 }
18084 }
18085
18086 if(state == stream_t::goodbit && stream.rdbuf()->sputn(str.c_str(), static_cast<::std::streamsize>(size)) != static_cast<::std::streamsize>(size))
18087 state |= stream_t::badbit;
18088 else {
18089 for(; 0 < pad; --pad){ // pad on right
18090 if(traits_t::eq_int_type(traits_t::eof(), stream.rdbuf()->sputc(stream.fill()))){
18091 state |= stream_t::badbit; // insertion failed, quit
18092 break;
18093 }
18094 }
18095 }
18096
18097 stream.width(0);
18098 }
18099 catch(...){
18100 stream.setstate(stream_t::badbit, true);
18101 return stream;
18102 }
18103 }
18104 stream.setstate(state);
18105 return stream;
18106 }
18107
18108 //array like支持
18109 template<class T>
18110 [[nodiscard]]inline auto size_of_array_like(const string_t<remove_cv<T>>& a)noexcept{ return a.size(); }
18111 template<class T>
18112 [[nodiscard]]inline auto begin_of_array_like(string_t<remove_cv<T>>& a)noexcept{ return a.c_str(); }
18113 template<class T>
18114 [[nodiscard]]inline auto begin_of_array_like(const string_t<remove_cv<T>>& a)noexcept{ return a.c_str(); }
18115
18116 //typedef
18117 typedef string_t<char_t>string;
18118 }
18119 using string_n::string_t;
18120 using string_n::string;
18121
18122 //file_end
18123
18124 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
18125
18126 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
18127 //_undefs.hpp
18128 /*
18129 未完成的elc解释器basic文件
18130 由steve02081504与Alex0125设计、编写
18131 转载时请在不对此文件做任何修改的同时注明出处
18132 项目地址:https://github.com/steve02081504/ELC
18133 */
18134 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
18135 //_undefs.hpp
18136 /*
18137 未完成的elc解释器_share文件
18138 由steve02081504与Alex0125设计、编写
18139 转载时请在不对此文件做任何修改的同时注明出处
18140 项目地址:https://github.com/steve02081504/ELC
18141 */
18142
18143 //defs at "_defs.hpp"
18144
18145 #if defined(_MSC_VER)
18146 #pragma warning(pop)
18147 #endif
18148 #undef suppress_msvc_warning
18149 #undef disable_msvc_warning
18150 #undef push_msvc_warning
18151 #undef pop_msvc_warning
18152 #undef push_and_disable_msvc_warning
18153
18154 //for basic_environment.hpp
18155 #undef BIT_POSSIBILITY
18156 //
18157 #if defined(ELC_VOID_NAME)
18158 #define void the_void
18159 #endif
18160
18161 // #undef often_noexcept
18162 #undef noexcept_as
18163 #undef noexcept_as_auto
18164 #undef constexpr_as
18165 #undef constexpr_as_auto
18166
18167 #undef using_method_from_base_t
18168 #undef using_method_from_value
18169
18170 #undef floop
18171 #undef enable_adl
18172
18173 #undef re_declvalue
18174 #undef re_decltype
18175
18176 #undef declvalue
18177
18178 #undef template_error
18179 #undef template_warning
18180
18181 #undef type_info_of
18182 #undef type_name_of
18183
18184 #undef is_common_attribute
18185 #undef is_special_attribute
18186
18187 #undef has_attribute
18188 #undef not_has_attribute
18189
18190 #undef float_size_of
18191 #undef bitnum_of
18192
18193 #undef def_common_attribute_with_nothing
18194 #undef def_special_attribute_with_nothing
18195
18196 #undef common_attribute_t
18197 #undef special_attribute_t
18198
18199 #undef enable_if
18200 #undef enabled_by_default
18201 #undef disabled_by_default
18202 #undef enable_if_not_ill_form
18203 #undef enable_flag
18204
18205 #undef was_an_ill_form
18206 #undef was_an_ill_form_with_parameter
18207 #undef was_not_an_ill_form
18208 #undef was_not_an_ill_form_and_noexcept
18209 #undef was_not_an_ill_form_with_parameter
18210
18211 #undef recursive_lambda
18212 #undef get_recursive_lambda_caller
18213 #undef lambda
18214 #undef lambda_with_catch
18215 #undef self_recursion
18216 #undef lambda_RLSRRS
18217
18218 #undef MAGIC
18219
18220 #undef nothing
18221
18222 #undef elseif
18223 #undef _big_than_
18224 #undef _small_than_
18225
18226 #if defined(_MSC_VER)
18227 #undef not
18228 #undef and
18229 #undef or
18230 #endif
18231
18232 #undef INTER_NAMESPACE
18233 #undef BREAK_NAMESPACE
18234
18235 #undef szie
18236 #undef form
18237
18238 #undef template_name
18239 #undef type_name
18240
18241 #undef not_in_debug
18242
18243 #undef es
18244 #undef ec
18245
18246 #undef ELC_TEST_EVENTNAME
18247
18248 #undef override_instance_struct
18249
18250 #undef distinctive
18251
18252 #undef force_inline
18253
18254 #undef with_no_vtable
18255
18256 #undef in_consteval
18257
18258 #undef no_vtable_struct
18259 #undef no_vtable_class
18260
18261 //file_end
18262
18263 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
18264
18265 //file_end
18266
18267 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
18268 }
18269 //strings
18270 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
18271 //str_code_convert.hpp
18272 /*
18273 未完成的elc解释器_share文件
18274 由steve02081504与Alex0125设计、编写
18275 转载时请在不对此文件做任何修改的同时注明出处
18276 项目地址:https://github.com/steve02081504/ELC
18277 */
18278 /*
18279 APIs说明
18280 elc依赖的基础函数.
18281 调整这些,实现快速移植,快速优化与行为自定义.
18282 */
18283 #if !defined(ELC_APIS_str_code_convert)
18284 #define ELC_APIS_str_code_convert
18285 #include <cuchar>
18286 #include <clocale>
18287 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/default_data_type.hpp"
18288 //default_data_type.hpp
18289 /*
18290 未完成的elc解释器_share文件
18291 由steve02081504与Alex0125设计、编写
18292 转载时请在不对此文件做任何修改的同时注明出处
18293 项目地址:https://github.com/steve02081504/ELC
18294 */
18295 namespace elc{
18296 /*ELC内部string统一采用char_t宽字符,使用setlocale(LC_ALL,"en_US.utf8")下的UTF编码。*/
18297 typedef char32_t char_t;
18298 /*ELC内部钦定int_t类型*/
18299 typedef int64_t int_t;
18300 /*ELC内部钦定uint_t类型*/
18301 typedef uint64_t uint_t;
18302 /*ELC内部钦定float_t类型*/
18303 typedef double float_t;
18304 /*ELC内部钦定float_size_t类型,用以描述内存大小的浮点状况*/
18305 typedef long double float_size_t;
18306 }
18307
18308 //file_end
18309
18310 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
18311 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
18312 //string
18313 //at namespace ::
18314 /*
18315 未完成的elc解释器include文件
18316 由steve02081504与Alex0125设计、编写
18317 转载时请在不对此文件做任何修改的同时注明出处
18318 项目地址:https://github.com/steve02081504/ELC
18319 */
18320 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
18321
18322 //file_end
18323
18324 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
18325 namespace elc::APIs::str_code_convert{
18326 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
18327 //_defs.hpp
18328 /*
18329 未完成的elc解释器_share文件
18330 由steve02081504与Alex0125设计、编写
18331 转载时请在不对此文件做任何修改的同时注明出处
18332 项目地址:https://github.com/steve02081504/ELC
18333 */
18334
18335 //undefs at "_undefs.hpp"
18336
18337 //set ELC_WARNING_LEVEL default to 4(max)
18338 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
18339
18340 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
18341 //basic_environment.hpp
18342 /*
18343 未完成的elc解释器_share文件
18344 由steve02081504与Alex0125设计、编写
18345 转载时请在不对此文件做任何修改的同时注明出处
18346 项目地址:https://github.com/steve02081504/ELC
18347 */
18348
18349 //每个bit(不是字节)的可能性
18350 //为什么c艹委员会不定义这个?
18351 #define BIT_POSSIBILITY 2
18352
18353 //file_end
18354
18355 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
18356
18357 #if defined(_MSC_VER)
18358 #pragma warning(push,ELC_WARNING_LEVEL)
18359 #pragma warning(disable:4099)//class与struct混用警告diss
18360 #pragma warning(disable:26812)//enum class安利diss.
18361 #pragma warning(disable:4584)//重复子类警告diss
18362 #pragma warning(disable:4250)//域控制继承警告diss
18363 #pragma warning(disable:26432)//不完全默认方法警告diss
18364 #pragma warning(disable:26435)//virtual override方法警告diss
18365 #pragma warning(disable:26481)//容器安利diss
18366 #pragma warning(disable:26446)//gsl::at安利diss
18367 #pragma warning(disable:26434)//方法覆盖警告diss
18368 #pragma warning(disable:26429)//gsl::not_null安利diss
18369 #pragma warning(disable:26471)//对void*进行static_cast安利diss
18370 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
18371 #pragma warning(disable:26473)//相同指针显式cast警告diss
18372 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
18373 #pragma warning(disable:26485)//数组作指针警告diss
18374 #pragma warning(disable:26490)//reinterpret_cast警告diss
18375 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
18376 #pragma warning(disable:26482)//非常数数组索引警告diss
18377 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
18378 #endif
18379 #if defined(_MSC_VER)
18380 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
18381 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
18382 #define push_msvc_warning() __pragma(warning(push))
18383 #define pop_msvc_warning() __pragma(warning(pop))
18384 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
18385 #else
18386 #define suppress_msvc_warning(...)
18387 #define disable_msvc_warning(...)
18388 #define push_msvc_warning()
18389 #define pop_msvc_warning()
18390 #define push_and_disable_msvc_warning(...)
18391 #endif
18392 //
18393 #if defined(ELC_VOID_NAME)
18394 #undef void
18395 #endif
18396
18397 // #define often_noexcept
18398 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
18399 #define noexcept_as_auto MAGIC//哦现在有了
18400 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
18401 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
18402
18403 #define using_method_from_base_t(name,...) \
18404 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
18405 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
18406 {\
18407 return base_t::name(forward<Args>(rest)...);\
18408 }\
18409
18410 #define using_method_from_value(name,value_name,...) \
18411 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
18412 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
18413 {\
18414 return value_name.name(forward<Args>(rest)...);\
18415 }\
18416
18417 #define floop while(__builtin_is_my_dick_still_there())
18418 #define enable_adl(name) void name()noexcept=delete
18419
18420 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
18421 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
18422
18423 #define declvalue(...) (::std::declval<__VA_ARGS__>())
18424
18425 /*实例化到此将引发错误*/
18426 #define template_error(reason) static_assert(template_error_helper<T>,reason)
18427 /*实例化到此将引发警告*/
18428 #define template_warning(reason) template_warning_helper<T>(reason)
18429
18430 //for type_info
18431 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
18432 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
18433
18434 #define is_common_attribute(name) public attribute<T,name<T>>
18435 #define is_special_attribute(name) public attribute<T,name>
18436
18437 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
18438 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
18439
18440 //for float_size_t
18441 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
18442 //bitnum_of
18443 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
18444
18445 //for attribute
18446 #define def_common_attribute_with_nothing(name) \
18447 template<typename T>\
18448 class name{}\
18449
18450 #define def_special_attribute_with_nothing(name) \
18451 class name{}\
18452
18453 #define common_attribute_t template<class>class
18454 #define special_attribute_t class
18455
18456 /*
18457 若参数的布尔值为零,那么此模板不会实例化
18458
18459 为什么不用cpp20的constraints?
18460 1.不能类内定义
18461 2.不能作为模板参数
18462 一句话总结:c艹标准会sb
18463 */
18464 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
18465 /*默认参与模板候选*/
18466 #define enabled_by_default class enable_state=void
18467 /*默认不参与模板候选*/
18468 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
18469 /*若参数为病式,那么此模板不会实例化*/
18470 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
18471 /*用于模板声明*/
18472 #define enable_flag class enable_state
18473
18474 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
18475 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
18476 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
18477 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
18478 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
18479
18480 /*让lambda递归更加美观*/
18481 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
18482 /*让lambda递归更加美观*/
18483 #define get_recursive_lambda_caller(name) \
18484 lambda_with_catch(&)(auto&&...Args){\
18485 return name(name,Args...);\
18486 }
18487 /*让lambda定义更加美观*/
18488 #define lambda []
18489 /*让lambda定义更加美观*/
18490 #define lambda_with_catch(...) [__VA_ARGS__]
18491 /*让lambda递归更加美观*/
18492 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
18493 //recursive_lambda_self_referential_reserved_symbolname
18494 #define lambda_RLSRRS _my_jb_super_sb_name_
18495
18496 #define MAGIC//ahh,ko no tenno da!
18497
18498 /*装饰性语法糖*/
18499 #define nothing
18500
18501 /*aya风格语法糖*/
18502 #define elseif else if
18503 /*aya风格语法糖*/
18504 #define _big_than_ >
18505 /*aya风格语法糖*/
18506 #define _small_than_ <
18507
18508 #if defined(_MSC_VER)
18509 #define not !
18510 #define and &&
18511 #define or ||
18512 #endif
18513
18514 /*进入名称空间,并不是很美观*/
18515 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
18516 /*退出名称空间,并不是很美观*/
18517 #define BREAK_NAMESPACE }
18518
18519 /*template说明符*/
18520 #define template_name template
18521 /*template说明符*/
18522 #define type_name class
18523
18524 #if defined(DEBUG) || defined(_DEBUG)
18525 #define not_in_debug 0
18526 #else
18527 #define not_in_debug 1
18528 #endif
18529
18530 #define es U""
18531 #define ec(ch) U ## ch
18532
18533 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
18534 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
18535 #else
18536 #define ELC_TEST_EVENTNAME(name)
18537 #endif
18538
18539 #define override_instance_struct \
18540 protected:\
18541 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
18542 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
18543 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
18544 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
18545 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
18546
18547 #if defined(_WIN32)
18548 #define distinctive __declspec(dllexport)
18549 #else
18550 #define distinctive
18551 #endif
18552
18553 #if defined(_WIN32)
18554 #define force_inline __forceinline
18555 #elif defined(__GNUC__)
18556 #define force_inline __attribute__((always_inline)) inline
18557 #else
18558 #define force_inline inline
18559 #endif
18560
18561 #if defined(_WIN32)
18562 #define with_no_vtable __declspec(novtable)
18563 #else
18564 #define with_no_vtable
18565 #endif
18566
18567 #define in_consteval (::std::is_constant_evaluated())
18568
18569 #define no_vtable_struct struct with_no_vtable
18570 #define no_vtable_class class with_no_vtable
18571
18572 //file_end
18573
18574 #line 20 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
18575
18576 using namespace ::elc::defs;//get def
18577
18578 [[nodiscard]]inline string_t<char> to_char_str(string_view_t<char_t> a)noexcept{
18579 string_t<char>aret;
18580 ::std::mbstate_t stat{};
18581 string_t old_lc=::std::setlocale(LC_CTYPE,nullptr);
18582 if(::std::setlocale(LC_CTYPE,"en_US.utf8")==nullptr)
18583 die_with(locale::str::setlocale_error);
18584 push_and_disable_msvc_warning(26494)//未初始化警告diss
18585 char r[MB_LEN_MAX];
18586 ptrdiff_t s;
18587 pop_msvc_warning();
18588 for(auto c:a){
18589 s=::std::c32rtomb(r,c,&stat);
18590 if(s < 0)//-1
18591 die_with(locale::str::code_convert_error);
18592 aret+=string_view_t<char>{(char*)r,note::size((size_t)s)};
18593 }
18594 ::std::setlocale(LC_CTYPE,old_lc.c_str());
18595 return aret;
18596 }
18597 [[nodiscard]]inline string_t<char_t> to_char_t_str(string_view_t<char> a)noexcept{
18598 string_t<char_t>aret;
18599 ::std::mbstate_t stat{};
18600 string_t old_lc=::std::setlocale(LC_CTYPE,nullptr);
18601 if(::std::setlocale(LC_CTYPE,"en_US.utf8")==nullptr)
18602 die_with(locale::str::setlocale_error);
18603 push_and_disable_msvc_warning(26494);//未初始化警告diss
18604 char_t c;
18605 ptrdiff_t s;
18606 pop_msvc_warning();
18607 auto i=a.cbegin(),e=a.cend();
18608 while(i!=e){
18609 s=::std::mbrtoc32(&c,i,MB_LEN_MAX,&stat);
18610 if(s < 0)//-3 或 -1
18611 die_with(locale::str::code_convert_error);
18612 i+=s;
18613 aret+=c;
18614 }
18615 ::std::setlocale(LC_CTYPE,old_lc.c_str());
18616 return aret;
18617 }
18618
18619 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
18620 //_undefs.hpp
18621 /*
18622 未完成的elc解释器_share文件
18623 由steve02081504与Alex0125设计、编写
18624 转载时请在不对此文件做任何修改的同时注明出处
18625 项目地址:https://github.com/steve02081504/ELC
18626 */
18627
18628 //defs at "_defs.hpp"
18629
18630 #if defined(_MSC_VER)
18631 #pragma warning(pop)
18632 #endif
18633 #undef suppress_msvc_warning
18634 #undef disable_msvc_warning
18635 #undef push_msvc_warning
18636 #undef pop_msvc_warning
18637 #undef push_and_disable_msvc_warning
18638
18639 //for basic_environment.hpp
18640 #undef BIT_POSSIBILITY
18641 //
18642 #if defined(ELC_VOID_NAME)
18643 #define void the_void
18644 #endif
18645
18646 // #undef often_noexcept
18647 #undef noexcept_as
18648 #undef noexcept_as_auto
18649 #undef constexpr_as
18650 #undef constexpr_as_auto
18651
18652 #undef using_method_from_base_t
18653 #undef using_method_from_value
18654
18655 #undef floop
18656 #undef enable_adl
18657
18658 #undef re_declvalue
18659 #undef re_decltype
18660
18661 #undef declvalue
18662
18663 #undef template_error
18664 #undef template_warning
18665
18666 #undef type_info_of
18667 #undef type_name_of
18668
18669 #undef is_common_attribute
18670 #undef is_special_attribute
18671
18672 #undef has_attribute
18673 #undef not_has_attribute
18674
18675 #undef float_size_of
18676 #undef bitnum_of
18677
18678 #undef def_common_attribute_with_nothing
18679 #undef def_special_attribute_with_nothing
18680
18681 #undef common_attribute_t
18682 #undef special_attribute_t
18683
18684 #undef enable_if
18685 #undef enabled_by_default
18686 #undef disabled_by_default
18687 #undef enable_if_not_ill_form
18688 #undef enable_flag
18689
18690 #undef was_an_ill_form
18691 #undef was_an_ill_form_with_parameter
18692 #undef was_not_an_ill_form
18693 #undef was_not_an_ill_form_and_noexcept
18694 #undef was_not_an_ill_form_with_parameter
18695
18696 #undef recursive_lambda
18697 #undef get_recursive_lambda_caller
18698 #undef lambda
18699 #undef lambda_with_catch
18700 #undef self_recursion
18701 #undef lambda_RLSRRS
18702
18703 #undef MAGIC
18704
18705 #undef nothing
18706
18707 #undef elseif
18708 #undef _big_than_
18709 #undef _small_than_
18710
18711 #if defined(_MSC_VER)
18712 #undef not
18713 #undef and
18714 #undef or
18715 #endif
18716
18717 #undef INTER_NAMESPACE
18718 #undef BREAK_NAMESPACE
18719
18720 #undef szie
18721 #undef form
18722
18723 #undef template_name
18724 #undef type_name
18725
18726 #undef not_in_debug
18727
18728 #undef es
18729 #undef ec
18730
18731 #undef ELC_TEST_EVENTNAME
18732
18733 #undef override_instance_struct
18734
18735 #undef distinctive
18736
18737 #undef force_inline
18738
18739 #undef with_no_vtable
18740
18741 #undef in_consteval
18742
18743 #undef no_vtable_struct
18744 #undef no_vtable_class
18745
18746 //file_end
18747
18748 #line 65 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
18749 }
18750 namespace elc::defs{
18751 using namespace elc::APIs::str_code_convert;
18752 }
18753 #endif
18754
18755 //file_end
18756
18757 #line 19 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
18758 namespace elc::defs{
18759 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
18760 //_defs.hpp
18761 /*
18762 未完成的elc解释器basic文件
18763 由steve02081504与Alex0125设计、编写
18764 转载时请在不对此文件做任何修改的同时注明出处
18765 项目地址:https://github.com/steve02081504/ELC
18766 */
18767 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
18768 //_defs.hpp
18769 /*
18770 未完成的elc解释器_share文件
18771 由steve02081504与Alex0125设计、编写
18772 转载时请在不对此文件做任何修改的同时注明出处
18773 项目地址:https://github.com/steve02081504/ELC
18774 */
18775
18776 //undefs at "_undefs.hpp"
18777
18778 //set ELC_WARNING_LEVEL default to 4(max)
18779 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
18780
18781 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
18782 //basic_environment.hpp
18783 /*
18784 未完成的elc解释器_share文件
18785 由steve02081504与Alex0125设计、编写
18786 转载时请在不对此文件做任何修改的同时注明出处
18787 项目地址:https://github.com/steve02081504/ELC
18788 */
18789
18790 //每个bit(不是字节)的可能性
18791 //为什么c艹委员会不定义这个?
18792 #define BIT_POSSIBILITY 2
18793
18794 //file_end
18795
18796 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
18797
18798 #if defined(_MSC_VER)
18799 #pragma warning(push,ELC_WARNING_LEVEL)
18800 #pragma warning(disable:4099)//class与struct混用警告diss
18801 #pragma warning(disable:26812)//enum class安利diss.
18802 #pragma warning(disable:4584)//重复子类警告diss
18803 #pragma warning(disable:4250)//域控制继承警告diss
18804 #pragma warning(disable:26432)//不完全默认方法警告diss
18805 #pragma warning(disable:26435)//virtual override方法警告diss
18806 #pragma warning(disable:26481)//容器安利diss
18807 #pragma warning(disable:26446)//gsl::at安利diss
18808 #pragma warning(disable:26434)//方法覆盖警告diss
18809 #pragma warning(disable:26429)//gsl::not_null安利diss
18810 #pragma warning(disable:26471)//对void*进行static_cast安利diss
18811 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
18812 #pragma warning(disable:26473)//相同指针显式cast警告diss
18813 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
18814 #pragma warning(disable:26485)//数组作指针警告diss
18815 #pragma warning(disable:26490)//reinterpret_cast警告diss
18816 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
18817 #pragma warning(disable:26482)//非常数数组索引警告diss
18818 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
18819 #endif
18820 #if defined(_MSC_VER)
18821 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
18822 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
18823 #define push_msvc_warning() __pragma(warning(push))
18824 #define pop_msvc_warning() __pragma(warning(pop))
18825 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
18826 #else
18827 #define suppress_msvc_warning(...)
18828 #define disable_msvc_warning(...)
18829 #define push_msvc_warning()
18830 #define pop_msvc_warning()
18831 #define push_and_disable_msvc_warning(...)
18832 #endif
18833 //
18834 #if defined(ELC_VOID_NAME)
18835 #undef void
18836 #endif
18837
18838 // #define often_noexcept
18839 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
18840 #define noexcept_as_auto MAGIC//哦现在有了
18841 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
18842 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
18843
18844 #define using_method_from_base_t(name,...) \
18845 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
18846 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
18847 {\
18848 return base_t::name(forward<Args>(rest)...);\
18849 }\
18850
18851 #define using_method_from_value(name,value_name,...) \
18852 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
18853 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
18854 {\
18855 return value_name.name(forward<Args>(rest)...);\
18856 }\
18857
18858 #define floop while(__builtin_is_my_dick_still_there())
18859 #define enable_adl(name) void name()noexcept=delete
18860
18861 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
18862 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
18863
18864 #define declvalue(...) (::std::declval<__VA_ARGS__>())
18865
18866 /*实例化到此将引发错误*/
18867 #define template_error(reason) static_assert(template_error_helper<T>,reason)
18868 /*实例化到此将引发警告*/
18869 #define template_warning(reason) template_warning_helper<T>(reason)
18870
18871 //for type_info
18872 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
18873 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
18874
18875 #define is_common_attribute(name) public attribute<T,name<T>>
18876 #define is_special_attribute(name) public attribute<T,name>
18877
18878 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
18879 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
18880
18881 //for float_size_t
18882 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
18883 //bitnum_of
18884 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
18885
18886 //for attribute
18887 #define def_common_attribute_with_nothing(name) \
18888 template<typename T>\
18889 class name{}\
18890
18891 #define def_special_attribute_with_nothing(name) \
18892 class name{}\
18893
18894 #define common_attribute_t template<class>class
18895 #define special_attribute_t class
18896
18897 /*
18898 若参数的布尔值为零,那么此模板不会实例化
18899
18900 为什么不用cpp20的constraints?
18901 1.不能类内定义
18902 2.不能作为模板参数
18903 一句话总结:c艹标准会sb
18904 */
18905 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
18906 /*默认参与模板候选*/
18907 #define enabled_by_default class enable_state=void
18908 /*默认不参与模板候选*/
18909 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
18910 /*若参数为病式,那么此模板不会实例化*/
18911 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
18912 /*用于模板声明*/
18913 #define enable_flag class enable_state
18914
18915 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
18916 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
18917 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
18918 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
18919 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
18920
18921 /*让lambda递归更加美观*/
18922 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
18923 /*让lambda递归更加美观*/
18924 #define get_recursive_lambda_caller(name) \
18925 lambda_with_catch(&)(auto&&...Args){\
18926 return name(name,Args...);\
18927 }
18928 /*让lambda定义更加美观*/
18929 #define lambda []
18930 /*让lambda定义更加美观*/
18931 #define lambda_with_catch(...) [__VA_ARGS__]
18932 /*让lambda递归更加美观*/
18933 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
18934 //recursive_lambda_self_referential_reserved_symbolname
18935 #define lambda_RLSRRS _my_jb_super_sb_name_
18936
18937 #define MAGIC//ahh,ko no tenno da!
18938
18939 /*装饰性语法糖*/
18940 #define nothing
18941
18942 /*aya风格语法糖*/
18943 #define elseif else if
18944 /*aya风格语法糖*/
18945 #define _big_than_ >
18946 /*aya风格语法糖*/
18947 #define _small_than_ <
18948
18949 #if defined(_MSC_VER)
18950 #define not !
18951 #define and &&
18952 #define or ||
18953 #endif
18954
18955 /*进入名称空间,并不是很美观*/
18956 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
18957 /*退出名称空间,并不是很美观*/
18958 #define BREAK_NAMESPACE }
18959
18960 /*template说明符*/
18961 #define template_name template
18962 /*template说明符*/
18963 #define type_name class
18964
18965 #if defined(DEBUG) || defined(_DEBUG)
18966 #define not_in_debug 0
18967 #else
18968 #define not_in_debug 1
18969 #endif
18970
18971 #define es U""
18972 #define ec(ch) U ## ch
18973
18974 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
18975 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
18976 #else
18977 #define ELC_TEST_EVENTNAME(name)
18978 #endif
18979
18980 #define override_instance_struct \
18981 protected:\
18982 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
18983 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
18984 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
18985 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
18986 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
18987
18988 #if defined(_WIN32)
18989 #define distinctive __declspec(dllexport)
18990 #else
18991 #define distinctive
18992 #endif
18993
18994 #if defined(_WIN32)
18995 #define force_inline __forceinline
18996 #elif defined(__GNUC__)
18997 #define force_inline __attribute__((always_inline)) inline
18998 #else
18999 #define force_inline inline
19000 #endif
19001
19002 #if defined(_WIN32)
19003 #define with_no_vtable __declspec(novtable)
19004 #else
19005 #define with_no_vtable
19006 #endif
19007
19008 #define in_consteval (::std::is_constant_evaluated())
19009
19010 #define no_vtable_struct struct with_no_vtable
19011 #define no_vtable_class class with_no_vtable
19012
19013 //file_end
19014
19015 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
19016
19017 //file_end
19018
19019 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
19020
19021 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/literal.hpp"
19022 //literal.hpp
19023 //at namespace elc::defs
19024 /*
19025 未完成的elc解释器string文件
19026 由steve02081504与Alex0125设计、编写
19027 转载时请在不对此文件做任何修改的同时注明出处
19028 项目地址:https://github.com/steve02081504/ELC
19029 */
19030 template<constexpr_str_n::constexpr_str_t_literal_helper str_helper>
19031 inline constexpr string operator""_elc_string()noexcept{
19032 return string(constexpr_str_n::operator""_constexpr_str<str_helper>());
19033 }
19034
19035 //file_end
19036
19037 #line 23 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
19038
19039 #if defined(ELC_TEST_ON)
19040 namespace string_part_test{
19041 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_test.hpp"
19042 //_test.hpp
19043 /*
19044 未完成的elc解释器string文件
19045 由steve02081504与Alex0125设计、编写
19046 转载时请在不对此文件做任何修改的同时注明出处
19047 项目地址:https://github.com/steve02081504/ELC
19048 */
19049 inline void test(){
19050 ELC_TEST_EVENTNAME("string部分测试");
19051 {
19052 {
19053 string_t a=es"";
19054 stest_accert(a.size()==0);
19055 a=es"asd";
19056 stest_accert(a.size()==3);
19057 a=es"asd"+a;
19058 stest_accert(a.size()==6);
19059 a+=es"asd";
19060 stest_accert(es"asd"+a==es"asdasdasdasd");
19061 a[1]=ec('e');
19062 stest_accert(a.substr(0,3)==es"aed");
19063 stest_accert(a.substr(3).size()==6);
19064 stest_accert(a[2]==ec('d'));
19065 a.clear();
19066 stest_accert(a.size()==0);
19067 a.resize(3,ec('d'));
19068 stest_accert(a==es"ddd");
19069 for(const char_t&c:a)
19070 stest_accert(c==ec('d'));
19071 a=es"abc";
19072 stest_accert(a.begin()==a.cbegin());
19073 stest_accert(*a.begin()==ec('a'));
19074 stest_accert(a.begin()<=a.cend());
19075 stest_accert(*a.rbegin()==ec('c'));
19076 stest_accert(a.rbegin()<=a.rend());
19077 stest_accert(a.rbegin()==a.end()-1);
19078 a.push_back(es"as");
19079 a.push_front(ec('p'));
19080 stest_accert(a == es"pabcas");
19081 a.erase(1,3);
19082 a.erase(1);
19083 stest_accert(a == es"ps");
19084 stest_accert(a.pop_front() == ec('p'));
19085 stest_accert(a.pop_back() == ec('s'));
19086 stest_accert(a.size() == 0);
19087 a=es"abc";
19088 stest_accert(a.pop_back(2) == es"bc");
19089 stest_accert(a.size() == 1);
19090 a.push_front(es"wqer");
19091 stest_accert(a==es"wqera");
19092 a.insert(2,es"123");
19093 a.insert(0,es"123");
19094 a.insert(a.size(),es"123");
19095 stest_accert(a[2] == ec('3'));
19096 a[5]=ec('6');
19097 a[6]=ec('6');
19098 a[7]=ec('6');
19099 a[8]=ec('6');
19100 stest_accert(a == es"123wq6666ra123");
19101 for(char_t& c: a.view())
19102 c ='7';
19103 stest_accert(a == es"77777777777777");
19104 }
19105 {
19106 using namespace elc;
19107 using elc::defs::hash;
19108 auto a = es"ab"_elc_string;//constexpr_string_data_t
19109 stest_accert(hash(a) == hash(string_view(es"ab")));
19110 string b = es"ab";//comn_string_data_t
19111 stest_accert(hash(b) == hash(string_view(es"ab")));
19112 stest_accert(b.memory_cost() > a.memory_cost());
19113 a += b;//sum_string_data_t -> constexpr_string_data_t
19114 // -> comn_string_data_t
19115 stest_accert(hash(a) == hash(string_view(es"abab")));
19116 a.insert(1, 'c');//inserted_string_data_t -> sum_string_data_t
19117 stest_accert(hash(a) == hash(string_view(es"acbab")));
19118 a.erase(2, 3);//erased_string_data_t -> inserted_string_data_t
19119 stest_accert(hash(a) == hash(string_view(es"ac")));
19120 a.push_back(es"123");//end_apply_string_data_t -> erased_string_data_t
19121 stest_accert(hash(a) == hash(string_view(es"ac123")));
19122 a.push_front(es"123");//head_apply_string_data_t -> end_apply_string_data_t
19123 stest_accert(hash(a) == hash(string_view(es"123ac123")));
19124 }
19125 }
19126 check_memory_lack();
19127 }
19128 inline void test_log_out(){
19129 }
19130 inline void test_end(){
19131 }
19132
19133 //file_end
19134
19135 #line 27 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
19136 }
19137 #endif
19138
19139 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
19140 //_undefs.hpp
19141 /*
19142 未完成的elc解释器basic文件
19143 由steve02081504与Alex0125设计、编写
19144 转载时请在不对此文件做任何修改的同时注明出处
19145 项目地址:https://github.com/steve02081504/ELC
19146 */
19147 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
19148 //_undefs.hpp
19149 /*
19150 未完成的elc解释器_share文件
19151 由steve02081504与Alex0125设计、编写
19152 转载时请在不对此文件做任何修改的同时注明出处
19153 项目地址:https://github.com/steve02081504/ELC
19154 */
19155
19156 //defs at "_defs.hpp"
19157
19158 #if defined(_MSC_VER)
19159 #pragma warning(pop)
19160 #endif
19161 #undef suppress_msvc_warning
19162 #undef disable_msvc_warning
19163 #undef push_msvc_warning
19164 #undef pop_msvc_warning
19165 #undef push_and_disable_msvc_warning
19166
19167 //for basic_environment.hpp
19168 #undef BIT_POSSIBILITY
19169 //
19170 #if defined(ELC_VOID_NAME)
19171 #define void the_void
19172 #endif
19173
19174 // #undef often_noexcept
19175 #undef noexcept_as
19176 #undef noexcept_as_auto
19177 #undef constexpr_as
19178 #undef constexpr_as_auto
19179
19180 #undef using_method_from_base_t
19181 #undef using_method_from_value
19182
19183 #undef floop
19184 #undef enable_adl
19185
19186 #undef re_declvalue
19187 #undef re_decltype
19188
19189 #undef declvalue
19190
19191 #undef template_error
19192 #undef template_warning
19193
19194 #undef type_info_of
19195 #undef type_name_of
19196
19197 #undef is_common_attribute
19198 #undef is_special_attribute
19199
19200 #undef has_attribute
19201 #undef not_has_attribute
19202
19203 #undef float_size_of
19204 #undef bitnum_of
19205
19206 #undef def_common_attribute_with_nothing
19207 #undef def_special_attribute_with_nothing
19208
19209 #undef common_attribute_t
19210 #undef special_attribute_t
19211
19212 #undef enable_if
19213 #undef enabled_by_default
19214 #undef disabled_by_default
19215 #undef enable_if_not_ill_form
19216 #undef enable_flag
19217
19218 #undef was_an_ill_form
19219 #undef was_an_ill_form_with_parameter
19220 #undef was_not_an_ill_form
19221 #undef was_not_an_ill_form_and_noexcept
19222 #undef was_not_an_ill_form_with_parameter
19223
19224 #undef recursive_lambda
19225 #undef get_recursive_lambda_caller
19226 #undef lambda
19227 #undef lambda_with_catch
19228 #undef self_recursion
19229 #undef lambda_RLSRRS
19230
19231 #undef MAGIC
19232
19233 #undef nothing
19234
19235 #undef elseif
19236 #undef _big_than_
19237 #undef _small_than_
19238
19239 #if defined(_MSC_VER)
19240 #undef not
19241 #undef and
19242 #undef or
19243 #endif
19244
19245 #undef INTER_NAMESPACE
19246 #undef BREAK_NAMESPACE
19247
19248 #undef szie
19249 #undef form
19250
19251 #undef template_name
19252 #undef type_name
19253
19254 #undef not_in_debug
19255
19256 #undef es
19257 #undef ec
19258
19259 #undef ELC_TEST_EVENTNAME
19260
19261 #undef override_instance_struct
19262
19263 #undef distinctive
19264
19265 #undef force_inline
19266
19267 #undef with_no_vtable
19268
19269 #undef in_consteval
19270
19271 #undef no_vtable_struct
19272 #undef no_vtable_class
19273
19274 //file_end
19275
19276 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
19277
19278 //file_end
19279
19280 #line 31 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
19281 }
19282 namespace elc{
19283 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_export.hpp"
19284 //_export.hpp
19285 //at namespace elc
19286 /*
19287 未完成的elc解释器string文件
19288 由steve02081504与Alex0125设计、编写
19289 转载时请在不对此文件做任何修改的同时注明出处
19290 项目地址:https://github.com/steve02081504/ELC
19291 */
19292 #define export using defs::
19293 export string_t;
19294 export string;
19295 export string_view_t;
19296 export string_view;
19297 export operator""_elc_string;
19298 export operator""_constexpr_str;
19299 #undef export
19300
19301 //file_end
19302
19303 #line 34 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
19304 }
19305 #if defined(ELC_CORE)
19306 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_multi/string_arec_as_value.hpp"
19307 //string_arec_as_value.hpp
19308 //at namespace ::
19309 //multi when ELC_STRING & ELC_CORE
19310 /*
19311 未完成的elc解释器string文件
19312 由steve02081504与Alex0125设计、编写
19313 转载时请在不对此文件做任何修改的同时注明出处
19314 项目地址:https://github.com/steve02081504/ELC
19315 */
19316 namespace elc::defs{
19317 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
19318 //_defs.hpp
19319 /*
19320 未完成的elc解释器basic文件
19321 由steve02081504与Alex0125设计、编写
19322 转载时请在不对此文件做任何修改的同时注明出处
19323 项目地址:https://github.com/steve02081504/ELC
19324 */
19325 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
19326 //_defs.hpp
19327 /*
19328 未完成的elc解释器_share文件
19329 由steve02081504与Alex0125设计、编写
19330 转载时请在不对此文件做任何修改的同时注明出处
19331 项目地址:https://github.com/steve02081504/ELC
19332 */
19333
19334 //undefs at "_undefs.hpp"
19335
19336 //set ELC_WARNING_LEVEL default to 4(max)
19337 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
19338
19339 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
19340 //basic_environment.hpp
19341 /*
19342 未完成的elc解释器_share文件
19343 由steve02081504与Alex0125设计、编写
19344 转载时请在不对此文件做任何修改的同时注明出处
19345 项目地址:https://github.com/steve02081504/ELC
19346 */
19347
19348 //每个bit(不是字节)的可能性
19349 //为什么c艹委员会不定义这个?
19350 #define BIT_POSSIBILITY 2
19351
19352 //file_end
19353
19354 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
19355
19356 #if defined(_MSC_VER)
19357 #pragma warning(push,ELC_WARNING_LEVEL)
19358 #pragma warning(disable:4099)//class与struct混用警告diss
19359 #pragma warning(disable:26812)//enum class安利diss.
19360 #pragma warning(disable:4584)//重复子类警告diss
19361 #pragma warning(disable:4250)//域控制继承警告diss
19362 #pragma warning(disable:26432)//不完全默认方法警告diss
19363 #pragma warning(disable:26435)//virtual override方法警告diss
19364 #pragma warning(disable:26481)//容器安利diss
19365 #pragma warning(disable:26446)//gsl::at安利diss
19366 #pragma warning(disable:26434)//方法覆盖警告diss
19367 #pragma warning(disable:26429)//gsl::not_null安利diss
19368 #pragma warning(disable:26471)//对void*进行static_cast安利diss
19369 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
19370 #pragma warning(disable:26473)//相同指针显式cast警告diss
19371 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
19372 #pragma warning(disable:26485)//数组作指针警告diss
19373 #pragma warning(disable:26490)//reinterpret_cast警告diss
19374 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
19375 #pragma warning(disable:26482)//非常数数组索引警告diss
19376 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
19377 #endif
19378 #if defined(_MSC_VER)
19379 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
19380 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
19381 #define push_msvc_warning() __pragma(warning(push))
19382 #define pop_msvc_warning() __pragma(warning(pop))
19383 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
19384 #else
19385 #define suppress_msvc_warning(...)
19386 #define disable_msvc_warning(...)
19387 #define push_msvc_warning()
19388 #define pop_msvc_warning()
19389 #define push_and_disable_msvc_warning(...)
19390 #endif
19391 //
19392 #if defined(ELC_VOID_NAME)
19393 #undef void
19394 #endif
19395
19396 // #define often_noexcept
19397 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
19398 #define noexcept_as_auto MAGIC//哦现在有了
19399 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
19400 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
19401
19402 #define using_method_from_base_t(name,...) \
19403 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
19404 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
19405 {\
19406 return base_t::name(forward<Args>(rest)...);\
19407 }\
19408
19409 #define using_method_from_value(name,value_name,...) \
19410 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
19411 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
19412 {\
19413 return value_name.name(forward<Args>(rest)...);\
19414 }\
19415
19416 #define floop while(__builtin_is_my_dick_still_there())
19417 #define enable_adl(name) void name()noexcept=delete
19418
19419 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
19420 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
19421
19422 #define declvalue(...) (::std::declval<__VA_ARGS__>())
19423
19424 /*实例化到此将引发错误*/
19425 #define template_error(reason) static_assert(template_error_helper<T>,reason)
19426 /*实例化到此将引发警告*/
19427 #define template_warning(reason) template_warning_helper<T>(reason)
19428
19429 //for type_info
19430 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
19431 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
19432
19433 #define is_common_attribute(name) public attribute<T,name<T>>
19434 #define is_special_attribute(name) public attribute<T,name>
19435
19436 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
19437 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
19438
19439 //for float_size_t
19440 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
19441 //bitnum_of
19442 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
19443
19444 //for attribute
19445 #define def_common_attribute_with_nothing(name) \
19446 template<typename T>\
19447 class name{}\
19448
19449 #define def_special_attribute_with_nothing(name) \
19450 class name{}\
19451
19452 #define common_attribute_t template<class>class
19453 #define special_attribute_t class
19454
19455 /*
19456 若参数的布尔值为零,那么此模板不会实例化
19457
19458 为什么不用cpp20的constraints?
19459 1.不能类内定义
19460 2.不能作为模板参数
19461 一句话总结:c艹标准会sb
19462 */
19463 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
19464 /*默认参与模板候选*/
19465 #define enabled_by_default class enable_state=void
19466 /*默认不参与模板候选*/
19467 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
19468 /*若参数为病式,那么此模板不会实例化*/
19469 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
19470 /*用于模板声明*/
19471 #define enable_flag class enable_state
19472
19473 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
19474 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
19475 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
19476 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
19477 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
19478
19479 /*让lambda递归更加美观*/
19480 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
19481 /*让lambda递归更加美观*/
19482 #define get_recursive_lambda_caller(name) \
19483 lambda_with_catch(&)(auto&&...Args){\
19484 return name(name,Args...);\
19485 }
19486 /*让lambda定义更加美观*/
19487 #define lambda []
19488 /*让lambda定义更加美观*/
19489 #define lambda_with_catch(...) [__VA_ARGS__]
19490 /*让lambda递归更加美观*/
19491 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
19492 //recursive_lambda_self_referential_reserved_symbolname
19493 #define lambda_RLSRRS _my_jb_super_sb_name_
19494
19495 #define MAGIC//ahh,ko no tenno da!
19496
19497 /*装饰性语法糖*/
19498 #define nothing
19499
19500 /*aya风格语法糖*/
19501 #define elseif else if
19502 /*aya风格语法糖*/
19503 #define _big_than_ >
19504 /*aya风格语法糖*/
19505 #define _small_than_ <
19506
19507 #if defined(_MSC_VER)
19508 #define not !
19509 #define and &&
19510 #define or ||
19511 #endif
19512
19513 /*进入名称空间,并不是很美观*/
19514 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
19515 /*退出名称空间,并不是很美观*/
19516 #define BREAK_NAMESPACE }
19517
19518 /*template说明符*/
19519 #define template_name template
19520 /*template说明符*/
19521 #define type_name class
19522
19523 #if defined(DEBUG) || defined(_DEBUG)
19524 #define not_in_debug 0
19525 #else
19526 #define not_in_debug 1
19527 #endif
19528
19529 #define es U""
19530 #define ec(ch) U ## ch
19531
19532 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
19533 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
19534 #else
19535 #define ELC_TEST_EVENTNAME(name)
19536 #endif
19537
19538 #define override_instance_struct \
19539 protected:\
19540 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
19541 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
19542 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
19543 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
19544 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
19545
19546 #if defined(_WIN32)
19547 #define distinctive __declspec(dllexport)
19548 #else
19549 #define distinctive
19550 #endif
19551
19552 #if defined(_WIN32)
19553 #define force_inline __forceinline
19554 #elif defined(__GNUC__)
19555 #define force_inline __attribute__((always_inline)) inline
19556 #else
19557 #define force_inline inline
19558 #endif
19559
19560 #if defined(_WIN32)
19561 #define with_no_vtable __declspec(novtable)
19562 #else
19563 #define with_no_vtable
19564 #endif
19565
19566 #define in_consteval (::std::is_constant_evaluated())
19567
19568 #define no_vtable_struct struct with_no_vtable
19569 #define no_vtable_class class with_no_vtable
19570
19571 //file_end
19572
19573 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
19574
19575 //file_end
19576
19577 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_multi/string_arec_as_value.hpp"
19578
19579 namespace string_n{
19580 template<class char_T>
19581 value arec_as_value(string_t<char_T>&str,const value index){
19582 size_t i=size_t(use_as<int_t>(index));
19583 if(!i)
19584 i=size_t(use_as<uint_t>(index));
19585 struct arec_data_t final:instance_struct<arec_data_t>
19586 ,value::base_data_t{
19587 typename string_t<char_T>::arec_t _m;
19588 arec_data_t(string_t<char_T>&str,size_t index)noexcept:_m(&str,index){};
19589 arec_data_t(const arec_data_t&ref)noexcept:_m(special_init,ref._m){}
19590 virtual ~arec_data_t()noexcept override final=default;
19591
19592 virtual void be_set(ptr a)noexcept override final{move(_m)=use_as<char_T>(a);}
19593 [[nodiscard]]virtual ptr get_value()noexcept override final{return core::make_binary_node_from<char_T>(move(_m));}
19594 [[nodiscard]]virtual base_data_t*copy()const noexcept override final{return get<arec_data_t>(*this);}
19595 [[nodiscard]]virtual base_type_info_t get_type_info()const noexcept override final{return type_info<arec_data_t>;}
19596 };
19597 return get<arec_data_t>(str,i);
19598 }
19599 }
19600
19601 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
19602 //_undefs.hpp
19603 /*
19604 未完成的elc解释器basic文件
19605 由steve02081504与Alex0125设计、编写
19606 转载时请在不对此文件做任何修改的同时注明出处
19607 项目地址:https://github.com/steve02081504/ELC
19608 */
19609 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
19610 //_undefs.hpp
19611 /*
19612 未完成的elc解释器_share文件
19613 由steve02081504与Alex0125设计、编写
19614 转载时请在不对此文件做任何修改的同时注明出处
19615 项目地址:https://github.com/steve02081504/ELC
19616 */
19617
19618 //defs at "_defs.hpp"
19619
19620 #if defined(_MSC_VER)
19621 #pragma warning(pop)
19622 #endif
19623 #undef suppress_msvc_warning
19624 #undef disable_msvc_warning
19625 #undef push_msvc_warning
19626 #undef pop_msvc_warning
19627 #undef push_and_disable_msvc_warning
19628
19629 //for basic_environment.hpp
19630 #undef BIT_POSSIBILITY
19631 //
19632 #if defined(ELC_VOID_NAME)
19633 #define void the_void
19634 #endif
19635
19636 // #undef often_noexcept
19637 #undef noexcept_as
19638 #undef noexcept_as_auto
19639 #undef constexpr_as
19640 #undef constexpr_as_auto
19641
19642 #undef using_method_from_base_t
19643 #undef using_method_from_value
19644
19645 #undef floop
19646 #undef enable_adl
19647
19648 #undef re_declvalue
19649 #undef re_decltype
19650
19651 #undef declvalue
19652
19653 #undef template_error
19654 #undef template_warning
19655
19656 #undef type_info_of
19657 #undef type_name_of
19658
19659 #undef is_common_attribute
19660 #undef is_special_attribute
19661
19662 #undef has_attribute
19663 #undef not_has_attribute
19664
19665 #undef float_size_of
19666 #undef bitnum_of
19667
19668 #undef def_common_attribute_with_nothing
19669 #undef def_special_attribute_with_nothing
19670
19671 #undef common_attribute_t
19672 #undef special_attribute_t
19673
19674 #undef enable_if
19675 #undef enabled_by_default
19676 #undef disabled_by_default
19677 #undef enable_if_not_ill_form
19678 #undef enable_flag
19679
19680 #undef was_an_ill_form
19681 #undef was_an_ill_form_with_parameter
19682 #undef was_not_an_ill_form
19683 #undef was_not_an_ill_form_and_noexcept
19684 #undef was_not_an_ill_form_with_parameter
19685
19686 #undef recursive_lambda
19687 #undef get_recursive_lambda_caller
19688 #undef lambda
19689 #undef lambda_with_catch
19690 #undef self_recursion
19691 #undef lambda_RLSRRS
19692
19693 #undef MAGIC
19694
19695 #undef nothing
19696
19697 #undef elseif
19698 #undef _big_than_
19699 #undef _small_than_
19700
19701 #if defined(_MSC_VER)
19702 #undef not
19703 #undef and
19704 #undef or
19705 #endif
19706
19707 #undef INTER_NAMESPACE
19708 #undef BREAK_NAMESPACE
19709
19710 #undef szie
19711 #undef form
19712
19713 #undef template_name
19714 #undef type_name
19715
19716 #undef not_in_debug
19717
19718 #undef es
19719 #undef ec
19720
19721 #undef ELC_TEST_EVENTNAME
19722
19723 #undef override_instance_struct
19724
19725 #undef distinctive
19726
19727 #undef force_inline
19728
19729 #undef with_no_vtable
19730
19731 #undef in_consteval
19732
19733 #undef no_vtable_struct
19734 #undef no_vtable_class
19735
19736 //file_end
19737
19738 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
19739
19740 //file_end
19741
19742 #line 35 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_multi/string_arec_as_value.hpp"
19743 }
19744
19745 //file_end
19746
19747 #line 37 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/string/_body.hpp"
19748 #endif
19749
19750 //file_end
19751
19752 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
19753 #endif
19754
19755 //file_end
19756
19757 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/lib_loader"
19758 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
19759 //_body.hpp
19760 //at namespace ::
19761 /*
19762 未完成的elc解释器template文件
19763 由steve02081504与Alex0125设计、编写
19764 转载时请在不对此文件做任何修改的同时注明出处
19765 项目地址:https://github.com/steve02081504/ELC
19766 */
19767 #if defined(ELC_TEST)
19768 #error "this part cannot be tested."
19769 #endif
19770 //include APIs:elc中可能根据编译环境而修改的底层函数
19771 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
19772 //str_code_convert.hpp
19773 /*
19774 未完成的elc解释器_share文件
19775 由steve02081504与Alex0125设计、编写
19776 转载时请在不对此文件做任何修改的同时注明出处
19777 项目地址:https://github.com/steve02081504/ELC
19778 */
19779 /*
19780 APIs说明
19781 elc依赖的基础函数.
19782 调整这些,实现快速移植,快速优化与行为自定义.
19783 */
19784 #line 70 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
19785
19786 //file_end
19787
19788 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
19789 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/library_load.hpp"
19790 //library_load.hpp
19791 /*
19792 未完成的elc解释器_share文件
19793 由steve02081504与Alex0125设计、编写
19794 转载时请在不对此文件做任何修改的同时注明出处
19795 项目地址:https://github.com/steve02081504/ELC
19796 */
19797 /*
19798 APIs说明
19799 elc依赖的基础函数.
19800 调整这些,实现快速移植,快速优化与行为自定义.
19801 */
19802 #if !defined(ELC_APIS_library_load)
19803 #define ELC_APIS_library_load
19804 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/_tools/decl_system_type.hpp"
19805 //decl_system_type.hpp
19806 /*
19807 未完成的elc解释器_share文件
19808 由steve02081504与Alex0125设计、编写
19809 转载时请在不对此文件做任何修改的同时注明出处
19810 项目地址:https://github.com/steve02081504/ELC
19811 */
19812 //copy&rewrite from steve02081504/steve.h
19813 #define linux 2
19814 #define windows 3
19815 #define other 4
19816 #if defined(__linux)||defined(__linux__)||defined(__gnu_linux__)
19817 #define SYSTEM_TYPE linux
19818 #elif defined(_WIN32)||defined(__MINGW32__)||defined(__CYGWIN__)
19819 #define SYSTEM_TYPE windows
19820 #else
19821 #define SYSTEM_TYPE other
19822 #endif
19823 #define ERROR_MSG_UNABLE_OS "Unable OS,edit this file on your own or contact ELC's producers."
19824
19825 //file_end
19826
19827 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/library_load.hpp"
19828 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
19829 //string
19830 //at namespace ::
19831 /*
19832 未完成的elc解释器include文件
19833 由steve02081504与Alex0125设计、编写
19834 转载时请在不对此文件做任何修改的同时注明出处
19835 项目地址:https://github.com/steve02081504/ELC
19836 */
19837 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
19838
19839 //file_end
19840
19841 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/library_load.hpp"
19842 #if SYSTEM_TYPE == linux
19843 #include <dlfcn.h>
19844 #elif SYSTEM_TYPE == windows
19845 #define NOMINMAX
19846 #include <Windows.h>
19847 #include <Libloaderapi.h>
19848 #include <Errhandlingapi.h>//GetLastError
19849 //to_string
19850 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/numerical_representation"
19851 //numerical_representation
19852 //at namespace ::
19853 /*
19854 未完成的elc解释器include文件
19855 由steve02081504与Alex0125设计、编写
19856 转载时请在不对此文件做任何修改的同时注明出处
19857 项目地址:https://github.com/steve02081504/ELC
19858 */
19859 #if !defined(ELC_NUMERICAL_REPRESENTATION)
19860 #define ELC_NUMERICAL_REPRESENTATION
19861 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
19862 //string
19863 //at namespace ::
19864 /*
19865 未完成的elc解释器include文件
19866 由steve02081504与Alex0125设计、编写
19867 转载时请在不对此文件做任何修改的同时注明出处
19868 项目地址:https://github.com/steve02081504/ELC
19869 */
19870 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
19871
19872 //file_end
19873
19874 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/numerical_representation"
19875 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/_body.hpp"
19876 //_body.hpp
19877 //at namespace ::
19878 /*
19879 未完成的elc解释器numerical_representation文件
19880 由steve02081504与Alex0125设计、编写
19881 转载时请在不对此文件做任何修改的同时注明出处
19882 项目地址:https://github.com/steve02081504/ELC
19883 */
19884 #if defined(ELC_TEST)
19885 #error "this part cannot be tested."
19886 #endif
19887 namespace elc::defs{
19888 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
19889 //_defs.hpp
19890 /*
19891 未完成的elc解释器basic文件
19892 由steve02081504与Alex0125设计、编写
19893 转载时请在不对此文件做任何修改的同时注明出处
19894 项目地址:https://github.com/steve02081504/ELC
19895 */
19896 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
19897 //_defs.hpp
19898 /*
19899 未完成的elc解释器_share文件
19900 由steve02081504与Alex0125设计、编写
19901 转载时请在不对此文件做任何修改的同时注明出处
19902 项目地址:https://github.com/steve02081504/ELC
19903 */
19904
19905 //undefs at "_undefs.hpp"
19906
19907 //set ELC_WARNING_LEVEL default to 4(max)
19908 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
19909
19910 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
19911 //basic_environment.hpp
19912 /*
19913 未完成的elc解释器_share文件
19914 由steve02081504与Alex0125设计、编写
19915 转载时请在不对此文件做任何修改的同时注明出处
19916 项目地址:https://github.com/steve02081504/ELC
19917 */
19918
19919 //每个bit(不是字节)的可能性
19920 //为什么c艹委员会不定义这个?
19921 #define BIT_POSSIBILITY 2
19922
19923 //file_end
19924
19925 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
19926
19927 #if defined(_MSC_VER)
19928 #pragma warning(push,ELC_WARNING_LEVEL)
19929 #pragma warning(disable:4099)//class与struct混用警告diss
19930 #pragma warning(disable:26812)//enum class安利diss.
19931 #pragma warning(disable:4584)//重复子类警告diss
19932 #pragma warning(disable:4250)//域控制继承警告diss
19933 #pragma warning(disable:26432)//不完全默认方法警告diss
19934 #pragma warning(disable:26435)//virtual override方法警告diss
19935 #pragma warning(disable:26481)//容器安利diss
19936 #pragma warning(disable:26446)//gsl::at安利diss
19937 #pragma warning(disable:26434)//方法覆盖警告diss
19938 #pragma warning(disable:26429)//gsl::not_null安利diss
19939 #pragma warning(disable:26471)//对void*进行static_cast安利diss
19940 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
19941 #pragma warning(disable:26473)//相同指针显式cast警告diss
19942 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
19943 #pragma warning(disable:26485)//数组作指针警告diss
19944 #pragma warning(disable:26490)//reinterpret_cast警告diss
19945 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
19946 #pragma warning(disable:26482)//非常数数组索引警告diss
19947 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
19948 #endif
19949 #if defined(_MSC_VER)
19950 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
19951 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
19952 #define push_msvc_warning() __pragma(warning(push))
19953 #define pop_msvc_warning() __pragma(warning(pop))
19954 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
19955 #else
19956 #define suppress_msvc_warning(...)
19957 #define disable_msvc_warning(...)
19958 #define push_msvc_warning()
19959 #define pop_msvc_warning()
19960 #define push_and_disable_msvc_warning(...)
19961 #endif
19962 //
19963 #if defined(ELC_VOID_NAME)
19964 #undef void
19965 #endif
19966
19967 // #define often_noexcept
19968 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
19969 #define noexcept_as_auto MAGIC//哦现在有了
19970 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
19971 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
19972
19973 #define using_method_from_base_t(name,...) \
19974 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
19975 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
19976 {\
19977 return base_t::name(forward<Args>(rest)...);\
19978 }\
19979
19980 #define using_method_from_value(name,value_name,...) \
19981 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
19982 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
19983 {\
19984 return value_name.name(forward<Args>(rest)...);\
19985 }\
19986
19987 #define floop while(__builtin_is_my_dick_still_there())
19988 #define enable_adl(name) void name()noexcept=delete
19989
19990 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
19991 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
19992
19993 #define declvalue(...) (::std::declval<__VA_ARGS__>())
19994
19995 /*实例化到此将引发错误*/
19996 #define template_error(reason) static_assert(template_error_helper<T>,reason)
19997 /*实例化到此将引发警告*/
19998 #define template_warning(reason) template_warning_helper<T>(reason)
19999
20000 //for type_info
20001 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
20002 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
20003
20004 #define is_common_attribute(name) public attribute<T,name<T>>
20005 #define is_special_attribute(name) public attribute<T,name>
20006
20007 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
20008 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
20009
20010 //for float_size_t
20011 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
20012 //bitnum_of
20013 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
20014
20015 //for attribute
20016 #define def_common_attribute_with_nothing(name) \
20017 template<typename T>\
20018 class name{}\
20019
20020 #define def_special_attribute_with_nothing(name) \
20021 class name{}\
20022
20023 #define common_attribute_t template<class>class
20024 #define special_attribute_t class
20025
20026 /*
20027 若参数的布尔值为零,那么此模板不会实例化
20028
20029 为什么不用cpp20的constraints?
20030 1.不能类内定义
20031 2.不能作为模板参数
20032 一句话总结:c艹标准会sb
20033 */
20034 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
20035 /*默认参与模板候选*/
20036 #define enabled_by_default class enable_state=void
20037 /*默认不参与模板候选*/
20038 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
20039 /*若参数为病式,那么此模板不会实例化*/
20040 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
20041 /*用于模板声明*/
20042 #define enable_flag class enable_state
20043
20044 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
20045 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
20046 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
20047 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
20048 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
20049
20050 /*让lambda递归更加美观*/
20051 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
20052 /*让lambda递归更加美观*/
20053 #define get_recursive_lambda_caller(name) \
20054 lambda_with_catch(&)(auto&&...Args){\
20055 return name(name,Args...);\
20056 }
20057 /*让lambda定义更加美观*/
20058 #define lambda []
20059 /*让lambda定义更加美观*/
20060 #define lambda_with_catch(...) [__VA_ARGS__]
20061 /*让lambda递归更加美观*/
20062 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
20063 //recursive_lambda_self_referential_reserved_symbolname
20064 #define lambda_RLSRRS _my_jb_super_sb_name_
20065
20066 #define MAGIC//ahh,ko no tenno da!
20067
20068 /*装饰性语法糖*/
20069 #define nothing
20070
20071 /*aya风格语法糖*/
20072 #define elseif else if
20073 /*aya风格语法糖*/
20074 #define _big_than_ >
20075 /*aya风格语法糖*/
20076 #define _small_than_ <
20077
20078 #if defined(_MSC_VER)
20079 #define not !
20080 #define and &&
20081 #define or ||
20082 #endif
20083
20084 /*进入名称空间,并不是很美观*/
20085 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
20086 /*退出名称空间,并不是很美观*/
20087 #define BREAK_NAMESPACE }
20088
20089 /*template说明符*/
20090 #define template_name template
20091 /*template说明符*/
20092 #define type_name class
20093
20094 #if defined(DEBUG) || defined(_DEBUG)
20095 #define not_in_debug 0
20096 #else
20097 #define not_in_debug 1
20098 #endif
20099
20100 #define es U""
20101 #define ec(ch) U ## ch
20102
20103 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
20104 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
20105 #else
20106 #define ELC_TEST_EVENTNAME(name)
20107 #endif
20108
20109 #define override_instance_struct \
20110 protected:\
20111 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
20112 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
20113 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
20114 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
20115 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
20116
20117 #if defined(_WIN32)
20118 #define distinctive __declspec(dllexport)
20119 #else
20120 #define distinctive
20121 #endif
20122
20123 #if defined(_WIN32)
20124 #define force_inline __forceinline
20125 #elif defined(__GNUC__)
20126 #define force_inline __attribute__((always_inline)) inline
20127 #else
20128 #define force_inline inline
20129 #endif
20130
20131 #if defined(_WIN32)
20132 #define with_no_vtable __declspec(novtable)
20133 #else
20134 #define with_no_vtable
20135 #endif
20136
20137 #define in_consteval (::std::is_constant_evaluated())
20138
20139 #define no_vtable_struct struct with_no_vtable
20140 #define no_vtable_class class with_no_vtable
20141
20142 //file_end
20143
20144 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
20145
20146 //file_end
20147
20148 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/_body.hpp"
20149
20150 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/defs.hpp"
20151 //defs.hpp
20152 /*
20153 未完成的elc解释器numerical_representation文件
20154 由steve02081504与Alex0125设计、编写
20155 转载时请在不对此文件做任何修改的同时注明出处
20156 项目地址:https://github.com/steve02081504/ELC
20157 */
20158
20159 /*
20160 客制化to_string用途类
20161 */
20162 struct base_numerical_representation_t{};
20163 /*
20164 记录数字的表示方式以便客制化to_string
20165 */
20166 class numerical_representation_t:public base_numerical_representation_t{
20167 size_t _radix=10;
20168 string _radix_table=es"0123456789"_constexpr_str;
20169 char_t _fractional_sign=ec('.');
20170 char_t _positive_sign=ec('+');
20171 char_t _negative_sign=ec('-');
20172 string _nan=es"NaN"_constexpr_str;
20173 string _signaling_nan=es"signaling_NaN"_constexpr_str;
20174 string _quiet_nan=es"quiet_NaN"_constexpr_str;
20175 string _inf=es"Inf"_constexpr_str;
20176 char_t _unknown_data_start_sign=ec('[');
20177 char_t _unknown_data_split_sign=ec(',');
20178 char_t _unknown_data_end_sign=ec(']');
20179 public:
20180 numerical_representation_t()noexcept=default;
20181 numerical_representation_t(const numerical_representation_t&)noexcept=default;
20182 numerical_representation_t(numerical_representation_t&&)noexcept=default;
20183 numerical_representation_t(size_t radix,string radix_table,
20184 char_t fractional_sign,
20185 char_t positive_sign,char_t negative_sign,
20186 string nan,string signaling_nan,string quiet_nan,
20187 string inf,
20188 char_t unknown_data_start_sign,char_t unknown_data_split_sign,char_t unknown_data_end_sign
20189 )noexcept:
20190 _radix(radix),_radix_table(radix_table),
20191 _fractional_sign(fractional_sign),
20192 _positive_sign(positive_sign),_negative_sign(negative_sign),
20193 _nan(nan),_signaling_nan(signaling_nan),_quiet_nan(quiet_nan),
20194 _inf(inf),
20195 _unknown_data_start_sign(unknown_data_start_sign),_unknown_data_split_sign(unknown_data_split_sign),_unknown_data_end_sign(unknown_data_end_sign)
20196 {}
20197 numerical_representation_t(size_t radix,string radix_table)noexcept:
20198 _radix(radix),
20199 _radix_table(radix_table)
20200 {}
20201 public:
20202 void set_radix(size_t radix)noexcept{
20203 _radix=radix;
20204 }
20205 void set_radix_table(string radix_table)noexcept{
20206 _radix_table=radix_table;
20207 _radix=radix_table.size();
20208 }
20209 void set_fractional_sign(char_t point)noexcept{
20210 _fractional_sign=point;
20211 }
20212 void set_positive_sign(char_t positive_sign)noexcept{
20213 _positive_sign=positive_sign;
20214 }
20215 void set_negative_sign(char_t negative_sign)noexcept{
20216 _negative_sign=negative_sign;
20217 }
20218 void set_nan(string nan)noexcept{
20219 _nan=nan;
20220 }
20221 void set_inf(string inf)noexcept{
20222 _inf=inf;
20223 }
20224 [[nodiscard]]constexpr size_t radix()const noexcept{
20225 return _radix;
20226 }
20227 [[nodiscard]]string radix_table()const noexcept{
20228 return _radix_table;
20229 }
20230 [[nodiscard]]constexpr char_t fractional_sign()const noexcept{
20231 return _fractional_sign;
20232 }
20233 [[nodiscard]]constexpr char_t positive_sign()const noexcept{
20234 return _positive_sign;
20235 }
20236 [[nodiscard]]constexpr char_t negative_sign()const noexcept{
20237 return _negative_sign;
20238 }
20239 [[nodiscard]]string nan()const noexcept{
20240 return _nan;
20241 }
20242 [[nodiscard]]string inf()const noexcept{
20243 return _inf;
20244 }
20245 private:
20246 //信息尾部分
20247 inline size_t get_info_tail_size_per_byte()const noexcept{
20248 constexpr auto info_threshold_base = pow(BIT_POSSIBILITY, bitnum_of(byte));
20249 const auto info_threshold = to_size_t(ceil(log(info_threshold_base, _radix)));
20250 return info_threshold;
20251 }
20252 template<typename T>
20253 inline size_t get_info_tail_size()const noexcept{
20254 return get_info_tail_size_per_byte()*sizeof(T);
20255 }
20256 template<typename T>
20257 inline string get_info_tail(T x)const noexcept{
20258 auto info_tail_size_per_byte = get_info_tail_size_per_byte();
20259 string aret;
20260 data_view<const T> view{&x};
20261 for(const byte c: view){
20262 auto s= to_string_rough((unsigned char)c);
20263 aret+=string{info_tail_size_per_byte-s.size(),_radix_table[0]}+s;
20264 }
20265 return aret;
20266 }
20267 template<typename T>
20268 inline T get_from_info_tail(string str)const noexcept{
20269 const auto info_tail_size_per_byte = get_info_tail_size_per_byte();
20270 T aret{};
20271 data_view<T> view{&aret};
20272 for(byte&c: view){
20273 auto s=str.substr(0,info_tail_size_per_byte);
20274 c=(byte)from_string_get<unsigned char>(s);
20275 str=str.substr(info_tail_size_per_byte);
20276 }
20277 return aret;
20278 }
20279 template<typename T>
20280 inline string to_string_num_base(T num)const noexcept{
20281 if constexpr(::std::is_floating_point_v<T>){
20282 string aret;
20283 suppress_msvc_warning(26494)//未初始化警告diss
20284 size_t order_of_magnitude;
20285 if(num>1)
20286 order_of_magnitude = to_size_t(floor(log(num,_radix)+1));
20287 else {
20288 order_of_magnitude = 0;
20289 aret=_radix_table[0];
20290 aret+=_fractional_sign;
20291 }
20292 num/=pow(_radix,order_of_magnitude);
20293 if(num>=1){
20294 aret=_radix_table[to_size_t(num)];
20295 num=0;
20296 }
20297 //Information threshold相关声明
20298 //这限制了在当前radix下mantissa的最大长度,避免如radix=3而num=0.25时的无限循环
20299 constinit auto info_threshold_base = pow(BIT_POSSIBILITY,bitnum_of(T));
20300 auto info_threshold = to_size_t(ceil(log(info_threshold_base,_radix)));
20301 //浮点数精度浮动,所以需要确定何时开始使用Info threshold
20302 bool is_mantissa_begined = false;
20303 while(num){
20304 //mantissa push部分
20305 num*=_radix;
20306 T first_char_index;
20307 num=::std::modf(num,&first_char_index);
20308 aret+=_radix_table[to_size_t(first_char_index)];
20309 //Information threshold制御部分
20310 if(to_size_t(first_char_index))
20311 is_mantissa_begined = true;
20312 if(is_mantissa_begined){
20313 if(info_threshold)
20314 info_threshold--;
20315 }
20316 //小数点计数部分
20317 if(order_of_magnitude){
20318 if(!--order_of_magnitude)
20319 aret+=_fractional_sign;
20320 }
20321 //结束判断
20322 if(!info_threshold && !order_of_magnitude)
20323 break;
20324 }
20325 if(order_of_magnitude)
20326 aret.append(order_of_magnitude,_radix_table[0]);
20327 if(aret.ends_with(_fractional_sign))
20328 aret.pop_back();
20329 return aret;
20330 }
20331 else{
20332 string aret;
20333 do{//do while,在num为0时也有返值
20334 const auto first_char_index = mod(num,_radix);
20335 num /= (T)_radix;
20336 aret.push_front(_radix_table[(size_t)first_char_index]);
20337 }while(num>=T{1});
20338 return aret;
20339 }
20340 }
20341 template<typename T>
20342 inline bool to_string_special_value_check(T num,string&str,bool is_negative)const noexcept{
20343 if constexpr(::std::numeric_limits<T>::has_signaling_NaN || ::std::numeric_limits<T>::has_quiet_NaN){
20344 if(::std::isnan(num)){
20345 if constexpr(::std::numeric_limits<T>::has_signaling_NaN){
20346 constexpr auto signaling_NaN = ::std::numeric_limits<T>::signaling_NaN();
20347 if(full_equal_in_byte(signaling_NaN,num)){
20348 str=_signaling_nan;
20349 return true;
20350 }
20351 auto negative_signaling_NaN = copy_as_negative(signaling_NaN);
20352 if(full_equal_in_byte(negative_signaling_NaN,num)){
20353 str=_negative_sign+_signaling_nan;
20354 return true;
20355 }
20356 }
20357 if constexpr(::std::numeric_limits<T>::has_quiet_NaN){
20358 constexpr auto quiet_NaN = ::std::numeric_limits<T>::quiet_NaN();
20359 if(full_equal_in_byte(quiet_NaN,num)){
20360 str=_quiet_nan;
20361 return true;
20362 }
20363 auto negative_quiet_NaN = copy_as_negative(quiet_NaN);
20364 if(full_equal_in_byte(negative_quiet_NaN,num)){
20365 str=_negative_sign+_quiet_nan;
20366 return true;
20367 }
20368 }
20369 str=_nan+_unknown_data_start_sign;
20370 data_view<T> view{&num};
20371 for(const byte c: view){
20372 str += to_string_rough((unsigned char)c);
20373 str += _unknown_data_split_sign;
20374 }
20375 str.back() = _unknown_data_end_sign;
20376 return true;
20377 }
20378 }
20379 if constexpr(::std::numeric_limits<T>::has_infinity){
20380 if(::std::isinf(num)){
20381 if constexpr(!::std::is_unsigned_v<T>)
20382 if(is_negative){
20383 str=_negative_sign+_inf;
20384 return true;
20385 }
20386 str=_inf;
20387 return true;
20388 }
20389 }
20390 return false;
20391 }
20392 template<typename T> requires ::std::is_arithmetic_v<T>
20393 inline string to_string_rough_no_special_value_check(T num)const noexcept{
20394 string aret;
20395 const bool is_negative=magic_number::is_negative(num);
20396 typedef decltype(lambda{
20397 if constexpr(::std::is_unsigned_v<T>||::std::is_floating_point_v<T>)
20398 return T();
20399 else
20400 return::std::make_unsigned_t<T>();
20401 }()) UT;
20402 //符号转无符号而不是num=-num避免INT_MAX这种情况下的溢出
20403 UT unum=UT(num);
20404 if constexpr(!::std::is_unsigned_v<T>)
20405 if(is_negative){
20406 aret=_negative_sign;
20407 unum=UT(-num);
20408 }
20409 aret+=to_string_num_base(unum);
20410 return aret;
20411 }
20412 public:
20413 template<typename T> requires ::std::is_arithmetic_v<T>
20414 inline string to_string_rough(T num)const noexcept{
20415 string aret;
20416 const bool is_negative=magic_number::is_negative(num);
20417 if(to_string_special_value_check(num,aret,is_negative))
20418 return aret;
20419 return to_string_rough_no_special_value_check(num);
20420 }
20421 private:
20422 template<typename T>
20423 inline T from_string_get_num_base(string str)const noexcept{
20424 if constexpr(::std::is_floating_point_v<T>){
20425 size_t order_of_magnitude = str.size();
20426 T aret{};
20427 size_t i=str.size();
20428 while(i){
20429 i--;
20430 const size_t index=_radix_table.find(str[i]);
20431 if(index==string::npos){
20432 if(str[i] == _fractional_sign){
20433 order_of_magnitude=i;
20434 continue;
20435 }
20436 return T();
20437 }
20438 aret+=(T)index;
20439 aret/=_radix;
20440 }
20441 aret*=pow(_radix, order_of_magnitude);
20442 return aret;
20443 }
20444 else {
20445 T aret{};
20446 for(size_t i = 0; i < str.size(); i++){
20447 const size_t index = _radix_table.find(str[i]);
20448 if(index == string::npos)
20449 return T();
20450 aret *= (T)_radix;
20451 aret += (T)index;
20452 }
20453 return aret;
20454 }
20455 }
20456 template<typename T>
20457 inline bool from_string_special_value_check(string str,T& num,bool is_negative)const noexcept{
20458 if constexpr(::std::numeric_limits<T>::has_signaling_NaN || ::std::numeric_limits<T>::has_quiet_NaN){
20459 if constexpr(::std::numeric_limits<T>::has_signaling_NaN)
20460 if(str==_signaling_nan){
20461 num= copy_as_negative(::std::numeric_limits<T>::signaling_NaN(),is_negative);
20462 return true;
20463 }
20464 if constexpr(::std::numeric_limits<T>::has_quiet_NaN)
20465 if(str==_quiet_nan){
20466 num= copy_as_negative(::std::numeric_limits<T>::quiet_NaN(),is_negative);
20467 return true;
20468 }
20469 if(str.starts_with(_nan+_unknown_data_start_sign)){
20470 str.pop_front(_nan.size()+1);
20471 str.pop_back();
20472 suppress_msvc_warning(26494)//未初始化警告diss
20473 data_block<T> block;
20474 size_t write_index = 0;
20475 floop{
20476 const size_t dot_pos = str.find(_unknown_data_split_sign);
20477 auto byte_str = str.substr(0, dot_pos);
20478 block[write_index++] = (byte)from_string_get<unsigned char>(byte_str);
20479 if(dot_pos == string::npos)
20480 break;
20481 str = str.substr(dot_pos+1);
20482 }
20483 num= data_cast<T>(block);
20484 return true;
20485 }
20486 elseif(str == _nan){
20487 if constexpr(::std::numeric_limits<T>::has_quiet_NaN)
20488 num= copy_as_negative(::std::numeric_limits<T>::quiet_NaN(),is_negative);
20489 else
20490 num= copy_as_negative(::std::numeric_limits<T>::signaling_NaN(),is_negative);
20491 return true;
20492 }
20493 }
20494 if constexpr(::std::numeric_limits<T>::has_infinity){
20495 if(str==_inf){
20496 if(is_negative)
20497 return copy_as_negative(::std::numeric_limits<T>::infinity());
20498 else
20499 return ::std::numeric_limits<T>::infinity();
20500 return true;
20501 }
20502 }
20503 return false;
20504 }
20505 public:
20506 template<typename T> requires ::std::is_arithmetic_v<T>
20507 inline T from_string_get(string str)const noexcept{
20508 //信息尾检查
20509 if constexpr(::std::is_floating_point_v<T>){
20510 const auto info_tail_size=get_info_tail_size<T>();
20511 if(str.size()>info_tail_size){
20512 const auto tail_pos=str.size()-info_tail_size;
20513 auto info_tail=str.substr(tail_pos);
20514 auto str_with_out_tail=str.substr(0,tail_pos);
20515 if(str_with_out_tail.back()==_fractional_sign)
20516 str_with_out_tail.pop_back();
20517 auto num=get_from_info_tail<T>(info_tail);
20518 if(to_string_rough(num)==str_with_out_tail)
20519 return num;
20520 str_with_out_tail+=string{info_tail.size(),_radix_table[0]};
20521 if(to_string_rough(num)==str_with_out_tail)
20522 return num;
20523 }
20524 }
20525 T num{};
20526 suppress_msvc_warning(26496);
20527 bool is_negative=false;
20528 if constexpr(!::std::is_unsigned_v<T>)
20529 if(str[0]==_negative_sign){
20530 is_negative=true;
20531 str.pop_front();
20532 }
20533 if(str[0]==_positive_sign)
20534 str.pop_front();
20535 if(from_string_special_value_check(str,num,is_negative))
20536 return num;
20537 typedef decltype(lambda{
20538 if constexpr(::std::is_unsigned_v<T>||::std::is_floating_point_v<T>)
20539 return T();
20540 else
20541 return::std::make_unsigned_t<T>();
20542 }()) UT;
20543 UT unum=from_string_get_num_base<UT>(str);
20544 return copy_as_negative<T>(unum,is_negative);
20545 }
20546 template<typename T> requires ::std::is_arithmetic_v<T>
20547 inline string to_string(T num)const noexcept{
20548 string aret;
20549 if(to_string_special_value_check(num,aret,is_negative(num)))
20550 return aret;
20551 aret=to_string_rough_no_special_value_check(num);
20552 if constexpr(::std::is_floating_point_v<T>){
20553 //进位器
20554 auto rounding_up_char = lambda_with_catch(&) (string::arec_t char_arc)noexcept{
20555 const char_t up_char = move(char_arc);
20556 size_t up_pos = _radix_table.find(up_char);
20557 up_pos++;
20558 if(up_pos == _radix)
20559 up_pos = 0;
20560 move(char_arc) = _radix_table[up_pos];
20561 return up_pos == 0;
20562 };
20563 auto rounding_up = lambda_with_catch(&) (string&str)noexcept{
20564 size_t i = str.size();
20565 while(i){
20566 if(rounding_up_char(str[i])){
20567 if(i--){
20568 if(str[i] == _fractional_sign)
20569 i--;
20570 }
20571 else
20572 str.push_front(_radix_table[1]);
20573 continue;
20574 }
20575 else
20576 break;
20577 }
20578 };
20579 size_t dot_pos=aret.find(_fractional_sign);
20580 //检查是否可反向转换
20581 if(from_string_get<T>(aret) != num){
20582 //获取并追加信息尾
20583 string info_tail=get_info_tail(num);
20584 if(dot_pos==string::npos){
20585 if(aret.ends_with(string{info_tail.size(),_radix_table[0]}))
20586 aret.pop_back(info_tail.size());
20587 else
20588 aret.push_back(_fractional_sign);
20589 }
20590 aret+=info_tail;
20591 return aret;
20592 }
20593 {
20594 //二分法查找最合适的切割位点.
20595 size_t left_pos = 0;
20596 size_t right_pos = aret.size();
20597 string better_aret,better_aret_last;
20598 if(dot_pos==string::npos)
20599 dot_pos=aret.size();
20600 do {
20601 size_t step_pos = (left_pos + right_pos) / 2;
20602 better_aret = aret.substr(0, step_pos);
20603 if(step_pos==dot_pos)
20604 step_pos++;
20605 //判断是否需要进位.(当被截断内容在radix_table的后半部分.)
20606 const char_t cut_char = aret[step_pos];
20607 const size_t cut_num = _radix_table.find(cut_char);
20608 if(cut_num >= _radix / 2)
20609 rounding_up(better_aret);
20610 if(better_aret.size() < dot_pos)//0补全
20611 better_aret.resize(dot_pos,_radix_table[0]);
20612 //判断当前切割位点有效性.
20613 if(from_string_get<T>(better_aret) == num){
20614 if(better_aret.back() == _radix_table[0]){
20615 const auto end_pos = max(better_aret.find_last_not_of(_radix_table[0])+1, dot_pos);
20616 better_aret.resize(end_pos);
20617 if(better_aret.back() == _fractional_sign)
20618 better_aret.pop_back();
20619 }
20620 right_pos = min(better_aret.size(), step_pos);
20621 better_aret_last = better_aret;
20622 }
20623 elseif(left_pos != step_pos)
20624 left_pos = step_pos;
20625 else
20626 left_pos++;
20627 } while(left_pos < right_pos);
20628 if(better_aret_last){
20629 aret = better_aret_last;
20630 if(aret.ends_with(_fractional_sign))
20631 aret.pop_back();
20632 }
20633 }
20634 }
20635 return aret;
20636 }
20637 };
20638 push_and_disable_msvc_warning(26426);
20639 distinctive inline numerical_representation_t trinary{3,es"012"_constexpr_str};
20640 distinctive inline numerical_representation_t binary{2,es"01"_constexpr_str};
20641 distinctive inline numerical_representation_t octal{8,es"01234567"_constexpr_str};
20642 distinctive inline numerical_representation_t decimal{10,es"0123456789"_constexpr_str};
20643 distinctive inline numerical_representation_t hexadecimal{16,es"0123456789abcdef"_constexpr_str};
20644 distinctive inline numerical_representation_t hexadecimal_upper{16,es"0123456789ABCDEF"_constexpr_str};
20645 pop_msvc_warning();
20646
20647 //字符串转换为数值
20648 template<typename T> requires ::std::is_arithmetic_v<T>
20649 inline T from_string_get(const string&str,const numerical_representation_t&radix=decimal)noexcept{
20650 return radix.from_string_get<T>(str);
20651 }
20652 //数值转换为字符串(小数部分粗略处理)
20653 template<typename T> requires ::std::is_arithmetic_v<T>
20654 inline string to_string_rough(T num,const numerical_representation_t&radix=decimal)noexcept{
20655 return radix.to_string_rough(num);
20656 }
20657 //数值转换为字符串
20658 template<typename T> requires ::std::is_arithmetic_v<T>
20659 inline string to_string(T num,const numerical_representation_t&radix=decimal)noexcept{
20660 return radix.to_string(num);
20661 }
20662
20663 //file_end
20664
20665 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/_body.hpp"
20666 #if defined(ELC_TEST_ON)
20667 namespace numerical_representation_part_test{
20668 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/_test.hpp"
20669 //_test.hpp
20670 /*
20671 未完成的elc解释器numerical_representation文件
20672 由steve02081504与Alex0125设计、编写
20673 转载时请在不对此文件做任何修改的同时注明出处
20674 项目地址:https://github.com/steve02081504/ELC
20675 */
20676 inline void test(){
20677 ELC_TEST_EVENTNAME("numerical_representation部分测试");
20678 }
20679 inline void test_log_out(){
20680 }
20681 inline void test_end(){
20682 }
20683
20684 //file_end
20685
20686 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/_body.hpp"
20687 }
20688 #endif
20689
20690 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
20691 //_undefs.hpp
20692 /*
20693 未完成的elc解释器basic文件
20694 由steve02081504与Alex0125设计、编写
20695 转载时请在不对此文件做任何修改的同时注明出处
20696 项目地址:https://github.com/steve02081504/ELC
20697 */
20698 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
20699 //_undefs.hpp
20700 /*
20701 未完成的elc解释器_share文件
20702 由steve02081504与Alex0125设计、编写
20703 转载时请在不对此文件做任何修改的同时注明出处
20704 项目地址:https://github.com/steve02081504/ELC
20705 */
20706
20707 //defs at "_defs.hpp"
20708
20709 #if defined(_MSC_VER)
20710 #pragma warning(pop)
20711 #endif
20712 #undef suppress_msvc_warning
20713 #undef disable_msvc_warning
20714 #undef push_msvc_warning
20715 #undef pop_msvc_warning
20716 #undef push_and_disable_msvc_warning
20717
20718 //for basic_environment.hpp
20719 #undef BIT_POSSIBILITY
20720 //
20721 #if defined(ELC_VOID_NAME)
20722 #define void the_void
20723 #endif
20724
20725 // #undef often_noexcept
20726 #undef noexcept_as
20727 #undef noexcept_as_auto
20728 #undef constexpr_as
20729 #undef constexpr_as_auto
20730
20731 #undef using_method_from_base_t
20732 #undef using_method_from_value
20733
20734 #undef floop
20735 #undef enable_adl
20736
20737 #undef re_declvalue
20738 #undef re_decltype
20739
20740 #undef declvalue
20741
20742 #undef template_error
20743 #undef template_warning
20744
20745 #undef type_info_of
20746 #undef type_name_of
20747
20748 #undef is_common_attribute
20749 #undef is_special_attribute
20750
20751 #undef has_attribute
20752 #undef not_has_attribute
20753
20754 #undef float_size_of
20755 #undef bitnum_of
20756
20757 #undef def_common_attribute_with_nothing
20758 #undef def_special_attribute_with_nothing
20759
20760 #undef common_attribute_t
20761 #undef special_attribute_t
20762
20763 #undef enable_if
20764 #undef enabled_by_default
20765 #undef disabled_by_default
20766 #undef enable_if_not_ill_form
20767 #undef enable_flag
20768
20769 #undef was_an_ill_form
20770 #undef was_an_ill_form_with_parameter
20771 #undef was_not_an_ill_form
20772 #undef was_not_an_ill_form_and_noexcept
20773 #undef was_not_an_ill_form_with_parameter
20774
20775 #undef recursive_lambda
20776 #undef get_recursive_lambda_caller
20777 #undef lambda
20778 #undef lambda_with_catch
20779 #undef self_recursion
20780 #undef lambda_RLSRRS
20781
20782 #undef MAGIC
20783
20784 #undef nothing
20785
20786 #undef elseif
20787 #undef _big_than_
20788 #undef _small_than_
20789
20790 #if defined(_MSC_VER)
20791 #undef not
20792 #undef and
20793 #undef or
20794 #endif
20795
20796 #undef INTER_NAMESPACE
20797 #undef BREAK_NAMESPACE
20798
20799 #undef szie
20800 #undef form
20801
20802 #undef template_name
20803 #undef type_name
20804
20805 #undef not_in_debug
20806
20807 #undef es
20808 #undef ec
20809
20810 #undef ELC_TEST_EVENTNAME
20811
20812 #undef override_instance_struct
20813
20814 #undef distinctive
20815
20816 #undef force_inline
20817
20818 #undef with_no_vtable
20819
20820 #undef in_consteval
20821
20822 #undef no_vtable_struct
20823 #undef no_vtable_class
20824
20825 //file_end
20826
20827 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
20828
20829 //file_end
20830
20831 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/_body.hpp"
20832 }
20833 namespace elc{
20834 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/_export.hpp"
20835 //_export.hpp
20836 //at namespace elc
20837 /*
20838 未完成的elc解释器numerical_representation文件
20839 由steve02081504与Alex0125设计、编写
20840 转载时请在不对此文件做任何修改的同时注明出处
20841 项目地址:https://github.com/steve02081504/ELC
20842 */
20843 #define export using defs::
20844 export to_string;
20845 export to_string_rough;
20846 export from_string_get;
20847 #undef export
20848
20849 //file_end
20850
20851 #line 25 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/numerical_representation/_body.hpp"
20852 }
20853
20854 //file_end
20855
20856 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/numerical_representation"
20857 #endif
20858
20859 //file_end
20860
20861 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/library_load.hpp"
20862 #else
20863 #error ERROR_MSG_UNABLE_OS
20864 #endif
20865 namespace elc::APIs::library_load{
20866 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
20867 //_defs.hpp
20868 /*
20869 未完成的elc解释器_share文件
20870 由steve02081504与Alex0125设计、编写
20871 转载时请在不对此文件做任何修改的同时注明出处
20872 项目地址:https://github.com/steve02081504/ELC
20873 */
20874
20875 //undefs at "_undefs.hpp"
20876
20877 //set ELC_WARNING_LEVEL default to 4(max)
20878 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
20879
20880 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
20881 //basic_environment.hpp
20882 /*
20883 未完成的elc解释器_share文件
20884 由steve02081504与Alex0125设计、编写
20885 转载时请在不对此文件做任何修改的同时注明出处
20886 项目地址:https://github.com/steve02081504/ELC
20887 */
20888
20889 //每个bit(不是字节)的可能性
20890 //为什么c艹委员会不定义这个?
20891 #define BIT_POSSIBILITY 2
20892
20893 //file_end
20894
20895 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
20896
20897 #if defined(_MSC_VER)
20898 #pragma warning(push,ELC_WARNING_LEVEL)
20899 #pragma warning(disable:4099)//class与struct混用警告diss
20900 #pragma warning(disable:26812)//enum class安利diss.
20901 #pragma warning(disable:4584)//重复子类警告diss
20902 #pragma warning(disable:4250)//域控制继承警告diss
20903 #pragma warning(disable:26432)//不完全默认方法警告diss
20904 #pragma warning(disable:26435)//virtual override方法警告diss
20905 #pragma warning(disable:26481)//容器安利diss
20906 #pragma warning(disable:26446)//gsl::at安利diss
20907 #pragma warning(disable:26434)//方法覆盖警告diss
20908 #pragma warning(disable:26429)//gsl::not_null安利diss
20909 #pragma warning(disable:26471)//对void*进行static_cast安利diss
20910 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
20911 #pragma warning(disable:26473)//相同指针显式cast警告diss
20912 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
20913 #pragma warning(disable:26485)//数组作指针警告diss
20914 #pragma warning(disable:26490)//reinterpret_cast警告diss
20915 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
20916 #pragma warning(disable:26482)//非常数数组索引警告diss
20917 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
20918 #endif
20919 #if defined(_MSC_VER)
20920 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
20921 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
20922 #define push_msvc_warning() __pragma(warning(push))
20923 #define pop_msvc_warning() __pragma(warning(pop))
20924 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
20925 #else
20926 #define suppress_msvc_warning(...)
20927 #define disable_msvc_warning(...)
20928 #define push_msvc_warning()
20929 #define pop_msvc_warning()
20930 #define push_and_disable_msvc_warning(...)
20931 #endif
20932 //
20933 #if defined(ELC_VOID_NAME)
20934 #undef void
20935 #endif
20936
20937 // #define often_noexcept
20938 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
20939 #define noexcept_as_auto MAGIC//哦现在有了
20940 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
20941 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
20942
20943 #define using_method_from_base_t(name,...) \
20944 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
20945 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
20946 {\
20947 return base_t::name(forward<Args>(rest)...);\
20948 }\
20949
20950 #define using_method_from_value(name,value_name,...) \
20951 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
20952 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
20953 {\
20954 return value_name.name(forward<Args>(rest)...);\
20955 }\
20956
20957 #define floop while(__builtin_is_my_dick_still_there())
20958 #define enable_adl(name) void name()noexcept=delete
20959
20960 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
20961 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
20962
20963 #define declvalue(...) (::std::declval<__VA_ARGS__>())
20964
20965 /*实例化到此将引发错误*/
20966 #define template_error(reason) static_assert(template_error_helper<T>,reason)
20967 /*实例化到此将引发警告*/
20968 #define template_warning(reason) template_warning_helper<T>(reason)
20969
20970 //for type_info
20971 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
20972 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
20973
20974 #define is_common_attribute(name) public attribute<T,name<T>>
20975 #define is_special_attribute(name) public attribute<T,name>
20976
20977 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
20978 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
20979
20980 //for float_size_t
20981 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
20982 //bitnum_of
20983 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
20984
20985 //for attribute
20986 #define def_common_attribute_with_nothing(name) \
20987 template<typename T>\
20988 class name{}\
20989
20990 #define def_special_attribute_with_nothing(name) \
20991 class name{}\
20992
20993 #define common_attribute_t template<class>class
20994 #define special_attribute_t class
20995
20996 /*
20997 若参数的布尔值为零,那么此模板不会实例化
20998
20999 为什么不用cpp20的constraints?
21000 1.不能类内定义
21001 2.不能作为模板参数
21002 一句话总结:c艹标准会sb
21003 */
21004 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
21005 /*默认参与模板候选*/
21006 #define enabled_by_default class enable_state=void
21007 /*默认不参与模板候选*/
21008 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
21009 /*若参数为病式,那么此模板不会实例化*/
21010 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
21011 /*用于模板声明*/
21012 #define enable_flag class enable_state
21013
21014 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
21015 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
21016 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
21017 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
21018 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
21019
21020 /*让lambda递归更加美观*/
21021 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
21022 /*让lambda递归更加美观*/
21023 #define get_recursive_lambda_caller(name) \
21024 lambda_with_catch(&)(auto&&...Args){\
21025 return name(name,Args...);\
21026 }
21027 /*让lambda定义更加美观*/
21028 #define lambda []
21029 /*让lambda定义更加美观*/
21030 #define lambda_with_catch(...) [__VA_ARGS__]
21031 /*让lambda递归更加美观*/
21032 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
21033 //recursive_lambda_self_referential_reserved_symbolname
21034 #define lambda_RLSRRS _my_jb_super_sb_name_
21035
21036 #define MAGIC//ahh,ko no tenno da!
21037
21038 /*装饰性语法糖*/
21039 #define nothing
21040
21041 /*aya风格语法糖*/
21042 #define elseif else if
21043 /*aya风格语法糖*/
21044 #define _big_than_ >
21045 /*aya风格语法糖*/
21046 #define _small_than_ <
21047
21048 #if defined(_MSC_VER)
21049 #define not !
21050 #define and &&
21051 #define or ||
21052 #endif
21053
21054 /*进入名称空间,并不是很美观*/
21055 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
21056 /*退出名称空间,并不是很美观*/
21057 #define BREAK_NAMESPACE }
21058
21059 /*template说明符*/
21060 #define template_name template
21061 /*template说明符*/
21062 #define type_name class
21063
21064 #if defined(DEBUG) || defined(_DEBUG)
21065 #define not_in_debug 0
21066 #else
21067 #define not_in_debug 1
21068 #endif
21069
21070 #define es U""
21071 #define ec(ch) U ## ch
21072
21073 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
21074 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
21075 #else
21076 #define ELC_TEST_EVENTNAME(name)
21077 #endif
21078
21079 #define override_instance_struct \
21080 protected:\
21081 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
21082 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
21083 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
21084 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
21085 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
21086
21087 #if defined(_WIN32)
21088 #define distinctive __declspec(dllexport)
21089 #else
21090 #define distinctive
21091 #endif
21092
21093 #if defined(_WIN32)
21094 #define force_inline __forceinline
21095 #elif defined(__GNUC__)
21096 #define force_inline __attribute__((always_inline)) inline
21097 #else
21098 #define force_inline inline
21099 #endif
21100
21101 #if defined(_WIN32)
21102 #define with_no_vtable __declspec(novtable)
21103 #else
21104 #define with_no_vtable
21105 #endif
21106
21107 #define in_consteval (::std::is_constant_evaluated())
21108
21109 #define no_vtable_struct struct with_no_vtable
21110 #define no_vtable_class class with_no_vtable
21111
21112 //file_end
21113
21114 #line 29 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/library_load.hpp"
21115
21116 using namespace ::elc::defs;
21117
21118 typedef
21119 #if SYSTEM_TYPE == linux
21120 void*
21121 #elif SYSTEM_TYPE == windows
21122 HMODULE
21123 #endif
21124 library_handle;
21125
21126 [[nodiscard]]inline library_handle base_load_library(const char*file_name)noexcept{
21127 //可返回bool意义为空的值表示失败
21128 return
21129 #if SYSTEM_TYPE == linux
21130 dlopen(file_name,RTLD_LAZY)
21131 #elif SYSTEM_TYPE == windows
21132 LoadLibraryA((LPCSTR)file_name)
21133 #endif
21134 ;
21135 }
21136 [[nodiscard]]inline string base_get_load_error()noexcept{
21137 return
21138 #if SYSTEM_TYPE == linux
21139 to_char_t_str(dlerror());
21140 #elif SYSTEM_TYPE == windows
21141 es"ERROR CODE:"_constexpr_str+to_string((DWORD)GetLastError());//傻逼微软设计的jb端口,再您妈的见
21142 #endif
21143 ;
21144 }
21145 inline void base_free_library(library_handle handle)noexcept{
21146 #if SYSTEM_TYPE == linux
21147 dlclose(handle)
21148 #elif SYSTEM_TYPE == windows
21149 FreeLibrary(handle)
21150 #endif
21151 ;
21152 }
21153 [[nodiscard]]inline void* base_get_symbol(library_handle handle,const char*symbol_name)noexcept{
21154 //可返回bool意义为空的值表示失败
21155 return
21156 #if SYSTEM_TYPE == linux
21157 dlsym(handle,symbol_name)
21158 #elif SYSTEM_TYPE == windows
21159 (void*)GetProcAddress(handle,(LPCSTR)symbol_name)
21160 #endif
21161 ;
21162 }
21163
21164 [[nodiscard]]inline library_handle load_library(string file_name)noexcept{
21165 //可返回bool意义为空的值表示失败
21166 return base_load_library(to_char_str(file_name).c_str());
21167 }
21168 [[nodiscard]]inline string get_load_error()noexcept{
21169 return base_get_load_error();
21170 }
21171 inline void free_library(library_handle handle)noexcept{
21172 return base_free_library(handle);
21173 }
21174 [[nodiscard]]inline void* get_symbol(library_handle handle,string symbol_name)noexcept{
21175 //可返回bool意义为空的值表示失败
21176 return base_get_symbol(handle,to_char_str(symbol_name).c_str());
21177 }
21178
21179 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
21180 //_undefs.hpp
21181 /*
21182 未完成的elc解释器_share文件
21183 由steve02081504与Alex0125设计、编写
21184 转载时请在不对此文件做任何修改的同时注明出处
21185 项目地址:https://github.com/steve02081504/ELC
21186 */
21187
21188 //defs at "_defs.hpp"
21189
21190 #if defined(_MSC_VER)
21191 #pragma warning(pop)
21192 #endif
21193 #undef suppress_msvc_warning
21194 #undef disable_msvc_warning
21195 #undef push_msvc_warning
21196 #undef pop_msvc_warning
21197 #undef push_and_disable_msvc_warning
21198
21199 //for basic_environment.hpp
21200 #undef BIT_POSSIBILITY
21201 //
21202 #if defined(ELC_VOID_NAME)
21203 #define void the_void
21204 #endif
21205
21206 // #undef often_noexcept
21207 #undef noexcept_as
21208 #undef noexcept_as_auto
21209 #undef constexpr_as
21210 #undef constexpr_as_auto
21211
21212 #undef using_method_from_base_t
21213 #undef using_method_from_value
21214
21215 #undef floop
21216 #undef enable_adl
21217
21218 #undef re_declvalue
21219 #undef re_decltype
21220
21221 #undef declvalue
21222
21223 #undef template_error
21224 #undef template_warning
21225
21226 #undef type_info_of
21227 #undef type_name_of
21228
21229 #undef is_common_attribute
21230 #undef is_special_attribute
21231
21232 #undef has_attribute
21233 #undef not_has_attribute
21234
21235 #undef float_size_of
21236 #undef bitnum_of
21237
21238 #undef def_common_attribute_with_nothing
21239 #undef def_special_attribute_with_nothing
21240
21241 #undef common_attribute_t
21242 #undef special_attribute_t
21243
21244 #undef enable_if
21245 #undef enabled_by_default
21246 #undef disabled_by_default
21247 #undef enable_if_not_ill_form
21248 #undef enable_flag
21249
21250 #undef was_an_ill_form
21251 #undef was_an_ill_form_with_parameter
21252 #undef was_not_an_ill_form
21253 #undef was_not_an_ill_form_and_noexcept
21254 #undef was_not_an_ill_form_with_parameter
21255
21256 #undef recursive_lambda
21257 #undef get_recursive_lambda_caller
21258 #undef lambda
21259 #undef lambda_with_catch
21260 #undef self_recursion
21261 #undef lambda_RLSRRS
21262
21263 #undef MAGIC
21264
21265 #undef nothing
21266
21267 #undef elseif
21268 #undef _big_than_
21269 #undef _small_than_
21270
21271 #if defined(_MSC_VER)
21272 #undef not
21273 #undef and
21274 #undef or
21275 #endif
21276
21277 #undef INTER_NAMESPACE
21278 #undef BREAK_NAMESPACE
21279
21280 #undef szie
21281 #undef form
21282
21283 #undef template_name
21284 #undef type_name
21285
21286 #undef not_in_debug
21287
21288 #undef es
21289 #undef ec
21290
21291 #undef ELC_TEST_EVENTNAME
21292
21293 #undef override_instance_struct
21294
21295 #undef distinctive
21296
21297 #undef force_inline
21298
21299 #undef with_no_vtable
21300
21301 #undef in_consteval
21302
21303 #undef no_vtable_struct
21304 #undef no_vtable_class
21305
21306 //file_end
21307
21308 #line 94 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/library_load.hpp"
21309 }
21310 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/_tools/undef_decl_system_type.hpp"
21311 //undef_decl_system_type.hpp
21312 /*
21313 未完成的elc解释器_share文件
21314 由steve02081504与Alex0125设计、编写
21315 转载时请在不对此文件做任何修改的同时注明出处
21316 项目地址:https://github.com/steve02081504/ELC
21317 */
21318 //copy&rewrite from steve02081504/evest.h
21319 #undef linux
21320 #undef windows
21321 #undef other
21322 #undef SYSTEM_TYPE
21323 #undef ERROR_MSG_UNABLE_OS
21324
21325 //file_end
21326
21327 #line 96 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/library_load.hpp"
21328 #endif
21329
21330 //file_end
21331
21332 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
21333 //include locale:自然语言相关的字符串
21334 //strings
21335 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
21336 //using.hpp
21337 /*
21338 未完成的elc解释器_share文件
21339 由steve02081504与Alex0125设计、编写
21340 转载时请在不对此文件做任何修改的同时注明出处
21341 项目地址:https://github.com/steve02081504/ELC
21342 */
21343 /*
21344 locale说明
21345 elc使用的字符串.
21346 调整这些,实现快速本地化.
21347 */
21348 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
21349
21350 //file_end
21351
21352 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
21353 namespace elc::defs{
21354 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
21355 //_defs.hpp
21356 /*
21357 未完成的elc解释器basic文件
21358 由steve02081504与Alex0125设计、编写
21359 转载时请在不对此文件做任何修改的同时注明出处
21360 项目地址:https://github.com/steve02081504/ELC
21361 */
21362 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
21363 //_defs.hpp
21364 /*
21365 未完成的elc解释器_share文件
21366 由steve02081504与Alex0125设计、编写
21367 转载时请在不对此文件做任何修改的同时注明出处
21368 项目地址:https://github.com/steve02081504/ELC
21369 */
21370
21371 //undefs at "_undefs.hpp"
21372
21373 //set ELC_WARNING_LEVEL default to 4(max)
21374 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
21375
21376 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
21377 //basic_environment.hpp
21378 /*
21379 未完成的elc解释器_share文件
21380 由steve02081504与Alex0125设计、编写
21381 转载时请在不对此文件做任何修改的同时注明出处
21382 项目地址:https://github.com/steve02081504/ELC
21383 */
21384
21385 //每个bit(不是字节)的可能性
21386 //为什么c艹委员会不定义这个?
21387 #define BIT_POSSIBILITY 2
21388
21389 //file_end
21390
21391 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
21392
21393 #if defined(_MSC_VER)
21394 #pragma warning(push,ELC_WARNING_LEVEL)
21395 #pragma warning(disable:4099)//class与struct混用警告diss
21396 #pragma warning(disable:26812)//enum class安利diss.
21397 #pragma warning(disable:4584)//重复子类警告diss
21398 #pragma warning(disable:4250)//域控制继承警告diss
21399 #pragma warning(disable:26432)//不完全默认方法警告diss
21400 #pragma warning(disable:26435)//virtual override方法警告diss
21401 #pragma warning(disable:26481)//容器安利diss
21402 #pragma warning(disable:26446)//gsl::at安利diss
21403 #pragma warning(disable:26434)//方法覆盖警告diss
21404 #pragma warning(disable:26429)//gsl::not_null安利diss
21405 #pragma warning(disable:26471)//对void*进行static_cast安利diss
21406 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
21407 #pragma warning(disable:26473)//相同指针显式cast警告diss
21408 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
21409 #pragma warning(disable:26485)//数组作指针警告diss
21410 #pragma warning(disable:26490)//reinterpret_cast警告diss
21411 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
21412 #pragma warning(disable:26482)//非常数数组索引警告diss
21413 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
21414 #endif
21415 #if defined(_MSC_VER)
21416 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
21417 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
21418 #define push_msvc_warning() __pragma(warning(push))
21419 #define pop_msvc_warning() __pragma(warning(pop))
21420 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
21421 #else
21422 #define suppress_msvc_warning(...)
21423 #define disable_msvc_warning(...)
21424 #define push_msvc_warning()
21425 #define pop_msvc_warning()
21426 #define push_and_disable_msvc_warning(...)
21427 #endif
21428 //
21429 #if defined(ELC_VOID_NAME)
21430 #undef void
21431 #endif
21432
21433 // #define often_noexcept
21434 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
21435 #define noexcept_as_auto MAGIC//哦现在有了
21436 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
21437 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
21438
21439 #define using_method_from_base_t(name,...) \
21440 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
21441 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
21442 {\
21443 return base_t::name(forward<Args>(rest)...);\
21444 }\
21445
21446 #define using_method_from_value(name,value_name,...) \
21447 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
21448 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
21449 {\
21450 return value_name.name(forward<Args>(rest)...);\
21451 }\
21452
21453 #define floop while(__builtin_is_my_dick_still_there())
21454 #define enable_adl(name) void name()noexcept=delete
21455
21456 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
21457 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
21458
21459 #define declvalue(...) (::std::declval<__VA_ARGS__>())
21460
21461 /*实例化到此将引发错误*/
21462 #define template_error(reason) static_assert(template_error_helper<T>,reason)
21463 /*实例化到此将引发警告*/
21464 #define template_warning(reason) template_warning_helper<T>(reason)
21465
21466 //for type_info
21467 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
21468 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
21469
21470 #define is_common_attribute(name) public attribute<T,name<T>>
21471 #define is_special_attribute(name) public attribute<T,name>
21472
21473 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
21474 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
21475
21476 //for float_size_t
21477 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
21478 //bitnum_of
21479 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
21480
21481 //for attribute
21482 #define def_common_attribute_with_nothing(name) \
21483 template<typename T>\
21484 class name{}\
21485
21486 #define def_special_attribute_with_nothing(name) \
21487 class name{}\
21488
21489 #define common_attribute_t template<class>class
21490 #define special_attribute_t class
21491
21492 /*
21493 若参数的布尔值为零,那么此模板不会实例化
21494
21495 为什么不用cpp20的constraints?
21496 1.不能类内定义
21497 2.不能作为模板参数
21498 一句话总结:c艹标准会sb
21499 */
21500 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
21501 /*默认参与模板候选*/
21502 #define enabled_by_default class enable_state=void
21503 /*默认不参与模板候选*/
21504 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
21505 /*若参数为病式,那么此模板不会实例化*/
21506 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
21507 /*用于模板声明*/
21508 #define enable_flag class enable_state
21509
21510 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
21511 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
21512 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
21513 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
21514 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
21515
21516 /*让lambda递归更加美观*/
21517 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
21518 /*让lambda递归更加美观*/
21519 #define get_recursive_lambda_caller(name) \
21520 lambda_with_catch(&)(auto&&...Args){\
21521 return name(name,Args...);\
21522 }
21523 /*让lambda定义更加美观*/
21524 #define lambda []
21525 /*让lambda定义更加美观*/
21526 #define lambda_with_catch(...) [__VA_ARGS__]
21527 /*让lambda递归更加美观*/
21528 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
21529 //recursive_lambda_self_referential_reserved_symbolname
21530 #define lambda_RLSRRS _my_jb_super_sb_name_
21531
21532 #define MAGIC//ahh,ko no tenno da!
21533
21534 /*装饰性语法糖*/
21535 #define nothing
21536
21537 /*aya风格语法糖*/
21538 #define elseif else if
21539 /*aya风格语法糖*/
21540 #define _big_than_ >
21541 /*aya风格语法糖*/
21542 #define _small_than_ <
21543
21544 #if defined(_MSC_VER)
21545 #define not !
21546 #define and &&
21547 #define or ||
21548 #endif
21549
21550 /*进入名称空间,并不是很美观*/
21551 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
21552 /*退出名称空间,并不是很美观*/
21553 #define BREAK_NAMESPACE }
21554
21555 /*template说明符*/
21556 #define template_name template
21557 /*template说明符*/
21558 #define type_name class
21559
21560 #if defined(DEBUG) || defined(_DEBUG)
21561 #define not_in_debug 0
21562 #else
21563 #define not_in_debug 1
21564 #endif
21565
21566 #define es U""
21567 #define ec(ch) U ## ch
21568
21569 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
21570 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
21571 #else
21572 #define ELC_TEST_EVENTNAME(name)
21573 #endif
21574
21575 #define override_instance_struct \
21576 protected:\
21577 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
21578 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
21579 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
21580 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
21581 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
21582
21583 #if defined(_WIN32)
21584 #define distinctive __declspec(dllexport)
21585 #else
21586 #define distinctive
21587 #endif
21588
21589 #if defined(_WIN32)
21590 #define force_inline __forceinline
21591 #elif defined(__GNUC__)
21592 #define force_inline __attribute__((always_inline)) inline
21593 #else
21594 #define force_inline inline
21595 #endif
21596
21597 #if defined(_WIN32)
21598 #define with_no_vtable __declspec(novtable)
21599 #else
21600 #define with_no_vtable
21601 #endif
21602
21603 #define in_consteval (::std::is_constant_evaluated())
21604
21605 #define no_vtable_struct struct with_no_vtable
21606 #define no_vtable_class class with_no_vtable
21607
21608 //file_end
21609
21610 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
21611
21612 //file_end
21613
21614 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
21615
21616 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/lib_loader.hpp"
21617 //lib_loader.hpp
21618 //at namespace elc
21619 /*
21620 未完成的elc解释器base文件
21621 由steve02081504与Alex0125设计、编写
21622 转载时请在不对此文件做任何修改的同时注明出处
21623 项目地址:https://github.com/steve02081504/ELC
21624 */
21625 namespace lib_loader_n{
21626 using namespace ::elc::APIs::library_load;
21627
21628 struct library_info_t;
21629 typedef comn_ptr_t<library_info_t> library_handle_t;
21630
21631 struct library_info_t:type_info_t<library_info_t>::template_name
21632 with_common_attribute<ref_able,never_in_array>,build_by_get_only{
21633 private:
21634 library_handle _m;
21635 string _name;
21636 string _error;
21637 public:
21638 constexpr explicit library_info_t(special_init_t)noexcept{
21639 _m=library_handle{0};
21640 _error=locale::str::lib_load::null_lib;
21641 attribute_ptr_cast<ref_able>(this)->init_never_ref_num_zero();
21642 }
21643 explicit library_info_t(string lib_name)noexcept{
21644 _name=lib_name;
21645 _m=load_library(lib_name);
21646
21647 if(!_m)
21648 _error=get_load_error();
21649 }
21650 ~library_info_t()noexcept{
21651 free_library(_m);
21652 }
21653 [[nodiscard]]explicit operator bool()const noexcept{
21654 return bool(_m);
21655 }
21656 [[nodiscard]]string get_error()noexcept{
21657 return _error;
21658 }
21659 [[nodiscard]]string get_name()noexcept{
21660 return _name;
21661 }
21662
21663 [[nodiscard]]void*get_symbol(string symbol_name)noexcept{
21664 return APIs::library_load::get_symbol(_m,symbol_name);
21665 }
21666 template<class symbol_t>
21667 [[nodiscard]]symbol_t&get_symbol_as(string symbol_name)noexcept{
21668 return*reinterpret_cast<symbol_t*>(get_symbol(symbol_name));
21669 }
21670 template<class Func_t>
21671 [[nodiscard]]function_t<Func_t>get_symbol_as_function(string symbol_name)noexcept;
21672 };
21673 [[nodiscard]]inline bool the_pointer_to_bool(const library_info_t*a)noexcept{
21674 return a->operator bool();
21675 }
21676 distinctive inline library_info_t null_lib{special_init};
21677 [[nodiscard]]inline constexpr library_info_t*the_get_null_ptr(const library_info_t*)noexcept{return&null_lib;}
21678
21679 /*
21680 base_symbol_t
21681 容纳一个library_handle_t以引用计数lib资源
21682 同时容纳自身的符号名以方便反向查找名称
21683 */
21685 library_handle_t _lib;
21686 string _name;
21687 };
21688 /*
21689 symbol_t
21690 继承function_data_warpper_t的operator()以可转换为function_t
21691 继承base_symbol_t以对lib的引用计数和包含更多相关信息
21692 */
21693 template<class Func_t>
21694 struct symbol_t;
21695 #if !defined(_MSC_VER)
21696 template<class Ret_t,class...Args_t,bool nothrow>
21697 struct symbol_t<Ret_t(Args_t...)noexcept(nothrow)>:function_data_warpper_t<Ret_t(*)(Args_t...)noexcept(nothrow)>,base_symbol_t{
21698 symbol_t(library_handle_t lib,string symbol_name,Ret_t(*self)(Args_t...)noexcept(nothrow))noexcept:
21699 function_data_warpper_t<Ret_t(*)(Args_t...)noexcept(nothrow)>(self),base_symbol_t(lib,symbol_name){}
21700 };
21701 #else
21702 //MSVC,我滴垃圾堆
21703 template<class Ret_t,class...Args_t>
21704 struct symbol_t<Ret_t(Args_t...)>:function_data_warpper_t<Ret_t(*)(Args_t...)>,base_symbol_t{
21705 symbol_t(library_handle_t lib,string symbol_name,Ret_t(*self)(Args_t...))noexcept:
21706 function_data_warpper_t<Ret_t(*)(Args_t...)>(self),base_symbol_t(lib,symbol_name){}
21707 };
21708 template<class Ret_t,class...Args_t>
21709 struct symbol_t<Ret_t(Args_t...)noexcept>:function_data_warpper_t<Ret_t(*)(Args_t...)noexcept>,base_symbol_t{
21710 symbol_t(library_handle_t lib,string symbol_name,Ret_t(*self)(Args_t...)noexcept)noexcept:
21711 function_data_warpper_t<Ret_t(*)(Args_t...)noexcept>(self),base_symbol_t(lib,symbol_name){}
21712 };
21713 #endif
21714
21715 template<class Func_t>
21716 [[nodiscard]]inline function_t<Func_t>library_info_t::get_symbol_as_function(string symbol_name)noexcept{
21717 auto func_p=&get_symbol_as<Func_t>(symbol_name);
21718 if(!func_p)
21719 return null_ptr;
21720 else
21721 return symbol_t<Func_t>(this,symbol_name,func_p);
21722 }
21723
21724 [[nodiscard]]inline library_handle_t load_lib(string lib_name)noexcept{
21725 return get<library_info_t>(lib_name);
21726 }
21727 template<class Func_t>
21728 [[nodiscard]]inline library_handle_t get_library_handle_form_symbol(function_t<Func_t> symbol)noexcept{
21729 auto symbol_info=symbol.get_as<base_symbol_t>();
21730 if(symbol_info.fail())
21731 return null_ptr;
21732 else
21733 return symbol_info.get_ref()._lib;
21734 }
21735 template<class Func_t>
21736 [[nodiscard]]inline string get_symbol_name_form_symbol(function_t<Func_t> symbol)noexcept{
21737 auto symbol_info=symbol.get_as<base_symbol_t>();
21738 if(symbol_info.fail())
21739 return {};
21740 else
21741 return symbol_info.get_ref()._name;
21742 }
21743 }
21744
21745 //file_end
21746
21747 #line 20 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
21748 #if defined(ELC_TEST_ON)
21749 namespace lib_loader_part_test{
21750 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_test.hpp"
21751 //_test.hpp
21752 /*
21753 未完成的elc解释器template文件
21754 由steve02081504与Alex0125设计、编写
21755 转载时请在不对此文件做任何修改的同时注明出处
21756 项目地址:https://github.com/steve02081504/ELC
21757 */
21758 inline void test(){
21759 ELC_TEST_EVENTNAME("lib_loader部分测试");
21760 }
21761 inline void test_log_out(){}
21762 inline void test_end{}
21763
21764 //file_end
21765
21766 #line 23 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
21767 }
21768 #endif
21769
21770 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
21771 //_undefs.hpp
21772 /*
21773 未完成的elc解释器basic文件
21774 由steve02081504与Alex0125设计、编写
21775 转载时请在不对此文件做任何修改的同时注明出处
21776 项目地址:https://github.com/steve02081504/ELC
21777 */
21778 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
21779 //_undefs.hpp
21780 /*
21781 未完成的elc解释器_share文件
21782 由steve02081504与Alex0125设计、编写
21783 转载时请在不对此文件做任何修改的同时注明出处
21784 项目地址:https://github.com/steve02081504/ELC
21785 */
21786
21787 //defs at "_defs.hpp"
21788
21789 #if defined(_MSC_VER)
21790 #pragma warning(pop)
21791 #endif
21792 #undef suppress_msvc_warning
21793 #undef disable_msvc_warning
21794 #undef push_msvc_warning
21795 #undef pop_msvc_warning
21796 #undef push_and_disable_msvc_warning
21797
21798 //for basic_environment.hpp
21799 #undef BIT_POSSIBILITY
21800 //
21801 #if defined(ELC_VOID_NAME)
21802 #define void the_void
21803 #endif
21804
21805 // #undef often_noexcept
21806 #undef noexcept_as
21807 #undef noexcept_as_auto
21808 #undef constexpr_as
21809 #undef constexpr_as_auto
21810
21811 #undef using_method_from_base_t
21812 #undef using_method_from_value
21813
21814 #undef floop
21815 #undef enable_adl
21816
21817 #undef re_declvalue
21818 #undef re_decltype
21819
21820 #undef declvalue
21821
21822 #undef template_error
21823 #undef template_warning
21824
21825 #undef type_info_of
21826 #undef type_name_of
21827
21828 #undef is_common_attribute
21829 #undef is_special_attribute
21830
21831 #undef has_attribute
21832 #undef not_has_attribute
21833
21834 #undef float_size_of
21835 #undef bitnum_of
21836
21837 #undef def_common_attribute_with_nothing
21838 #undef def_special_attribute_with_nothing
21839
21840 #undef common_attribute_t
21841 #undef special_attribute_t
21842
21843 #undef enable_if
21844 #undef enabled_by_default
21845 #undef disabled_by_default
21846 #undef enable_if_not_ill_form
21847 #undef enable_flag
21848
21849 #undef was_an_ill_form
21850 #undef was_an_ill_form_with_parameter
21851 #undef was_not_an_ill_form
21852 #undef was_not_an_ill_form_and_noexcept
21853 #undef was_not_an_ill_form_with_parameter
21854
21855 #undef recursive_lambda
21856 #undef get_recursive_lambda_caller
21857 #undef lambda
21858 #undef lambda_with_catch
21859 #undef self_recursion
21860 #undef lambda_RLSRRS
21861
21862 #undef MAGIC
21863
21864 #undef nothing
21865
21866 #undef elseif
21867 #undef _big_than_
21868 #undef _small_than_
21869
21870 #if defined(_MSC_VER)
21871 #undef not
21872 #undef and
21873 #undef or
21874 #endif
21875
21876 #undef INTER_NAMESPACE
21877 #undef BREAK_NAMESPACE
21878
21879 #undef szie
21880 #undef form
21881
21882 #undef template_name
21883 #undef type_name
21884
21885 #undef not_in_debug
21886
21887 #undef es
21888 #undef ec
21889
21890 #undef ELC_TEST_EVENTNAME
21891
21892 #undef override_instance_struct
21893
21894 #undef distinctive
21895
21896 #undef force_inline
21897
21898 #undef with_no_vtable
21899
21900 #undef in_consteval
21901
21902 #undef no_vtable_struct
21903 #undef no_vtable_class
21904
21905 //file_end
21906
21907 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
21908
21909 //file_end
21910
21911 #line 27 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
21912 }
21913 namespace elc{
21914 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_export.hpp"
21915 //_export.hpp
21916 //at namespace elc
21917 /*
21918 未完成的elc解释器template文件
21919 由steve02081504与Alex0125设计、编写
21920 转载时请在不对此文件做任何修改的同时注明出处
21921 项目地址:https://github.com/steve02081504/ELC
21922 */
21923 #define export using defs::lib_loader_n::
21924 export library_handle_t;
21925 export load_lib;
21926 export get_library_handle_form_symbol;
21927 export get_symbol_name_form_symbol;
21928 #undef export
21929
21930 //file_end
21931
21932 #line 30 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/lib_loader/_body.hpp"
21933 }
21934
21935 //file_end
21936
21937 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/lib_loader"
21938 #endif
21939
21940 //file_end
21941
21942 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
21943 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/literal"
21944 //literal
21945 //at namespace ::
21946 /*
21947 未完成的elc解释器include文件
21948 由steve02081504与Alex0125设计、编写
21949 转载时请在不对此文件做任何修改的同时注明出处
21950 项目地址:https://github.com/steve02081504/ELC
21951 */
21952 #if !defined(ELC_LITERAL)
21953 #define ELC_LITERAL
21954 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/literal/_body.hpp"
21955 //_body.hpp
21956 //at namespace ::
21957 /*
21958 未完成的elc解释器literal文件
21959 由steve02081504与Alex0125设计、编写
21960 转载时请在不对此文件做任何修改的同时注明出处
21961 项目地址:https://github.com/steve02081504/ELC
21962 */
21963 #if defined(ELC_TEST)
21964 #error "this part cannot be tested."
21965 #endif
21966 namespace elc::defs{
21967 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
21968 //_defs.hpp
21969 /*
21970 未完成的elc解释器basic文件
21971 由steve02081504与Alex0125设计、编写
21972 转载时请在不对此文件做任何修改的同时注明出处
21973 项目地址:https://github.com/steve02081504/ELC
21974 */
21975 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
21976 //_defs.hpp
21977 /*
21978 未完成的elc解释器_share文件
21979 由steve02081504与Alex0125设计、编写
21980 转载时请在不对此文件做任何修改的同时注明出处
21981 项目地址:https://github.com/steve02081504/ELC
21982 */
21983
21984 //undefs at "_undefs.hpp"
21985
21986 //set ELC_WARNING_LEVEL default to 4(max)
21987 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
21988
21989 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
21990 //basic_environment.hpp
21991 /*
21992 未完成的elc解释器_share文件
21993 由steve02081504与Alex0125设计、编写
21994 转载时请在不对此文件做任何修改的同时注明出处
21995 项目地址:https://github.com/steve02081504/ELC
21996 */
21997
21998 //每个bit(不是字节)的可能性
21999 //为什么c艹委员会不定义这个?
22000 #define BIT_POSSIBILITY 2
22001
22002 //file_end
22003
22004 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
22005
22006 #if defined(_MSC_VER)
22007 #pragma warning(push,ELC_WARNING_LEVEL)
22008 #pragma warning(disable:4099)//class与struct混用警告diss
22009 #pragma warning(disable:26812)//enum class安利diss.
22010 #pragma warning(disable:4584)//重复子类警告diss
22011 #pragma warning(disable:4250)//域控制继承警告diss
22012 #pragma warning(disable:26432)//不完全默认方法警告diss
22013 #pragma warning(disable:26435)//virtual override方法警告diss
22014 #pragma warning(disable:26481)//容器安利diss
22015 #pragma warning(disable:26446)//gsl::at安利diss
22016 #pragma warning(disable:26434)//方法覆盖警告diss
22017 #pragma warning(disable:26429)//gsl::not_null安利diss
22018 #pragma warning(disable:26471)//对void*进行static_cast安利diss
22019 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
22020 #pragma warning(disable:26473)//相同指针显式cast警告diss
22021 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
22022 #pragma warning(disable:26485)//数组作指针警告diss
22023 #pragma warning(disable:26490)//reinterpret_cast警告diss
22024 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
22025 #pragma warning(disable:26482)//非常数数组索引警告diss
22026 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
22027 #endif
22028 #if defined(_MSC_VER)
22029 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
22030 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
22031 #define push_msvc_warning() __pragma(warning(push))
22032 #define pop_msvc_warning() __pragma(warning(pop))
22033 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
22034 #else
22035 #define suppress_msvc_warning(...)
22036 #define disable_msvc_warning(...)
22037 #define push_msvc_warning()
22038 #define pop_msvc_warning()
22039 #define push_and_disable_msvc_warning(...)
22040 #endif
22041 //
22042 #if defined(ELC_VOID_NAME)
22043 #undef void
22044 #endif
22045
22046 // #define often_noexcept
22047 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
22048 #define noexcept_as_auto MAGIC//哦现在有了
22049 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
22050 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
22051
22052 #define using_method_from_base_t(name,...) \
22053 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
22054 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
22055 {\
22056 return base_t::name(forward<Args>(rest)...);\
22057 }\
22058
22059 #define using_method_from_value(name,value_name,...) \
22060 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
22061 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
22062 {\
22063 return value_name.name(forward<Args>(rest)...);\
22064 }\
22065
22066 #define floop while(__builtin_is_my_dick_still_there())
22067 #define enable_adl(name) void name()noexcept=delete
22068
22069 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
22070 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
22071
22072 #define declvalue(...) (::std::declval<__VA_ARGS__>())
22073
22074 /*实例化到此将引发错误*/
22075 #define template_error(reason) static_assert(template_error_helper<T>,reason)
22076 /*实例化到此将引发警告*/
22077 #define template_warning(reason) template_warning_helper<T>(reason)
22078
22079 //for type_info
22080 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
22081 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
22082
22083 #define is_common_attribute(name) public attribute<T,name<T>>
22084 #define is_special_attribute(name) public attribute<T,name>
22085
22086 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
22087 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
22088
22089 //for float_size_t
22090 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
22091 //bitnum_of
22092 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
22093
22094 //for attribute
22095 #define def_common_attribute_with_nothing(name) \
22096 template<typename T>\
22097 class name{}\
22098
22099 #define def_special_attribute_with_nothing(name) \
22100 class name{}\
22101
22102 #define common_attribute_t template<class>class
22103 #define special_attribute_t class
22104
22105 /*
22106 若参数的布尔值为零,那么此模板不会实例化
22107
22108 为什么不用cpp20的constraints?
22109 1.不能类内定义
22110 2.不能作为模板参数
22111 一句话总结:c艹标准会sb
22112 */
22113 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
22114 /*默认参与模板候选*/
22115 #define enabled_by_default class enable_state=void
22116 /*默认不参与模板候选*/
22117 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
22118 /*若参数为病式,那么此模板不会实例化*/
22119 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
22120 /*用于模板声明*/
22121 #define enable_flag class enable_state
22122
22123 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
22124 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
22125 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
22126 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
22127 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
22128
22129 /*让lambda递归更加美观*/
22130 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
22131 /*让lambda递归更加美观*/
22132 #define get_recursive_lambda_caller(name) \
22133 lambda_with_catch(&)(auto&&...Args){\
22134 return name(name,Args...);\
22135 }
22136 /*让lambda定义更加美观*/
22137 #define lambda []
22138 /*让lambda定义更加美观*/
22139 #define lambda_with_catch(...) [__VA_ARGS__]
22140 /*让lambda递归更加美观*/
22141 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
22142 //recursive_lambda_self_referential_reserved_symbolname
22143 #define lambda_RLSRRS _my_jb_super_sb_name_
22144
22145 #define MAGIC//ahh,ko no tenno da!
22146
22147 /*装饰性语法糖*/
22148 #define nothing
22149
22150 /*aya风格语法糖*/
22151 #define elseif else if
22152 /*aya风格语法糖*/
22153 #define _big_than_ >
22154 /*aya风格语法糖*/
22155 #define _small_than_ <
22156
22157 #if defined(_MSC_VER)
22158 #define not !
22159 #define and &&
22160 #define or ||
22161 #endif
22162
22163 /*进入名称空间,并不是很美观*/
22164 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
22165 /*退出名称空间,并不是很美观*/
22166 #define BREAK_NAMESPACE }
22167
22168 /*template说明符*/
22169 #define template_name template
22170 /*template说明符*/
22171 #define type_name class
22172
22173 #if defined(DEBUG) || defined(_DEBUG)
22174 #define not_in_debug 0
22175 #else
22176 #define not_in_debug 1
22177 #endif
22178
22179 #define es U""
22180 #define ec(ch) U ## ch
22181
22182 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
22183 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
22184 #else
22185 #define ELC_TEST_EVENTNAME(name)
22186 #endif
22187
22188 #define override_instance_struct \
22189 protected:\
22190 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
22191 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
22192 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
22193 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
22194 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
22195
22196 #if defined(_WIN32)
22197 #define distinctive __declspec(dllexport)
22198 #else
22199 #define distinctive
22200 #endif
22201
22202 #if defined(_WIN32)
22203 #define force_inline __forceinline
22204 #elif defined(__GNUC__)
22205 #define force_inline __attribute__((always_inline)) inline
22206 #else
22207 #define force_inline inline
22208 #endif
22209
22210 #if defined(_WIN32)
22211 #define with_no_vtable __declspec(novtable)
22212 #else
22213 #define with_no_vtable
22214 #endif
22215
22216 #define in_consteval (::std::is_constant_evaluated())
22217
22218 #define no_vtable_struct struct with_no_vtable
22219 #define no_vtable_class class with_no_vtable
22220
22221 //file_end
22222
22223 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
22224
22225 //file_end
22226
22227 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/literal/_body.hpp"
22228
22229 #if defined(ELC_TEST_ON)
22230 namespace literal_part_test{
22231 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/literal/_test.hpp"
22232 //_test.hpp
22233 /*
22234 未完成的elc解释器literal文件
22235 由steve02081504与Alex0125设计、编写
22236 转载时请在不对此文件做任何修改的同时注明出处
22237 项目地址:https://github.com/steve02081504/ELC
22238 */
22239 inline void test(){
22240 ELC_TEST_EVENTNAME("literal部分测试");
22241 }
22242 inline void test_log_out(){
22243 }
22244 inline void test_end{
22245 }
22246
22247 //file_end
22248
22249 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/literal/_body.hpp"
22250 }
22251 #endif
22252
22253 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
22254 //_undefs.hpp
22255 /*
22256 未完成的elc解释器basic文件
22257 由steve02081504与Alex0125设计、编写
22258 转载时请在不对此文件做任何修改的同时注明出处
22259 项目地址:https://github.com/steve02081504/ELC
22260 */
22261 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
22262 //_undefs.hpp
22263 /*
22264 未完成的elc解释器_share文件
22265 由steve02081504与Alex0125设计、编写
22266 转载时请在不对此文件做任何修改的同时注明出处
22267 项目地址:https://github.com/steve02081504/ELC
22268 */
22269
22270 //defs at "_defs.hpp"
22271
22272 #if defined(_MSC_VER)
22273 #pragma warning(pop)
22274 #endif
22275 #undef suppress_msvc_warning
22276 #undef disable_msvc_warning
22277 #undef push_msvc_warning
22278 #undef pop_msvc_warning
22279 #undef push_and_disable_msvc_warning
22280
22281 //for basic_environment.hpp
22282 #undef BIT_POSSIBILITY
22283 //
22284 #if defined(ELC_VOID_NAME)
22285 #define void the_void
22286 #endif
22287
22288 // #undef often_noexcept
22289 #undef noexcept_as
22290 #undef noexcept_as_auto
22291 #undef constexpr_as
22292 #undef constexpr_as_auto
22293
22294 #undef using_method_from_base_t
22295 #undef using_method_from_value
22296
22297 #undef floop
22298 #undef enable_adl
22299
22300 #undef re_declvalue
22301 #undef re_decltype
22302
22303 #undef declvalue
22304
22305 #undef template_error
22306 #undef template_warning
22307
22308 #undef type_info_of
22309 #undef type_name_of
22310
22311 #undef is_common_attribute
22312 #undef is_special_attribute
22313
22314 #undef has_attribute
22315 #undef not_has_attribute
22316
22317 #undef float_size_of
22318 #undef bitnum_of
22319
22320 #undef def_common_attribute_with_nothing
22321 #undef def_special_attribute_with_nothing
22322
22323 #undef common_attribute_t
22324 #undef special_attribute_t
22325
22326 #undef enable_if
22327 #undef enabled_by_default
22328 #undef disabled_by_default
22329 #undef enable_if_not_ill_form
22330 #undef enable_flag
22331
22332 #undef was_an_ill_form
22333 #undef was_an_ill_form_with_parameter
22334 #undef was_not_an_ill_form
22335 #undef was_not_an_ill_form_and_noexcept
22336 #undef was_not_an_ill_form_with_parameter
22337
22338 #undef recursive_lambda
22339 #undef get_recursive_lambda_caller
22340 #undef lambda
22341 #undef lambda_with_catch
22342 #undef self_recursion
22343 #undef lambda_RLSRRS
22344
22345 #undef MAGIC
22346
22347 #undef nothing
22348
22349 #undef elseif
22350 #undef _big_than_
22351 #undef _small_than_
22352
22353 #if defined(_MSC_VER)
22354 #undef not
22355 #undef and
22356 #undef or
22357 #endif
22358
22359 #undef INTER_NAMESPACE
22360 #undef BREAK_NAMESPACE
22361
22362 #undef szie
22363 #undef form
22364
22365 #undef template_name
22366 #undef type_name
22367
22368 #undef not_in_debug
22369
22370 #undef es
22371 #undef ec
22372
22373 #undef ELC_TEST_EVENTNAME
22374
22375 #undef override_instance_struct
22376
22377 #undef distinctive
22378
22379 #undef force_inline
22380
22381 #undef with_no_vtable
22382
22383 #undef in_consteval
22384
22385 #undef no_vtable_struct
22386 #undef no_vtable_class
22387
22388 //file_end
22389
22390 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
22391
22392 //file_end
22393
22394 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/literal/_body.hpp"
22395 }
22396 namespace elc{
22397 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/literal/_export.hpp"
22398 //_export.hpp
22399 //at namespace elc
22400 /*
22401 未完成的elc解释器literal文件
22402 由steve02081504与Alex0125设计、编写
22403 转载时请在不对此文件做任何修改的同时注明出处
22404 项目地址:https://github.com/steve02081504/ELC
22405 */
22406 #define export using ::
22407 #undef export
22408
22409 //file_end
22410
22411 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/literal/_body.hpp"
22412 }
22413
22414 //file_end
22415
22416 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/literal"
22417 #endif
22418
22419 //file_end
22420
22421 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
22422 //#include "log"
22423 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/memory_stream"
22424 //memory_stream
22425 //at namespace ::
22426 /*
22427 未完成的elc解释器include文件
22428 由steve02081504与Alex0125设计、编写
22429 转载时请在不对此文件做任何修改的同时注明出处
22430 项目地址:https://github.com/steve02081504/ELC
22431 */
22432 #if !defined(ELC_MEMORY_STREAM)
22433 #define ELC_MEMORY_STREAM
22434 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/_body.hpp"
22435 //_body.hpp
22436 //at namespace ::
22437 /*
22438 未完成的elc解释器memory_stream文件
22439 由steve02081504与Alex0125设计、编写
22440 转载时请在不对此文件做任何修改的同时注明出处
22441 项目地址:https://github.com/steve02081504/ELC
22442 */
22443 #if defined(ELC_TEST)
22444 #error "this part cannot be tested."
22445 #endif
22446 namespace elc::defs{
22447 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
22448 //_defs.hpp
22449 /*
22450 未完成的elc解释器basic文件
22451 由steve02081504与Alex0125设计、编写
22452 转载时请在不对此文件做任何修改的同时注明出处
22453 项目地址:https://github.com/steve02081504/ELC
22454 */
22455 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
22456 //_defs.hpp
22457 /*
22458 未完成的elc解释器_share文件
22459 由steve02081504与Alex0125设计、编写
22460 转载时请在不对此文件做任何修改的同时注明出处
22461 项目地址:https://github.com/steve02081504/ELC
22462 */
22463
22464 //undefs at "_undefs.hpp"
22465
22466 //set ELC_WARNING_LEVEL default to 4(max)
22467 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
22468
22469 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
22470 //basic_environment.hpp
22471 /*
22472 未完成的elc解释器_share文件
22473 由steve02081504与Alex0125设计、编写
22474 转载时请在不对此文件做任何修改的同时注明出处
22475 项目地址:https://github.com/steve02081504/ELC
22476 */
22477
22478 //每个bit(不是字节)的可能性
22479 //为什么c艹委员会不定义这个?
22480 #define BIT_POSSIBILITY 2
22481
22482 //file_end
22483
22484 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
22485
22486 #if defined(_MSC_VER)
22487 #pragma warning(push,ELC_WARNING_LEVEL)
22488 #pragma warning(disable:4099)//class与struct混用警告diss
22489 #pragma warning(disable:26812)//enum class安利diss.
22490 #pragma warning(disable:4584)//重复子类警告diss
22491 #pragma warning(disable:4250)//域控制继承警告diss
22492 #pragma warning(disable:26432)//不完全默认方法警告diss
22493 #pragma warning(disable:26435)//virtual override方法警告diss
22494 #pragma warning(disable:26481)//容器安利diss
22495 #pragma warning(disable:26446)//gsl::at安利diss
22496 #pragma warning(disable:26434)//方法覆盖警告diss
22497 #pragma warning(disable:26429)//gsl::not_null安利diss
22498 #pragma warning(disable:26471)//对void*进行static_cast安利diss
22499 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
22500 #pragma warning(disable:26473)//相同指针显式cast警告diss
22501 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
22502 #pragma warning(disable:26485)//数组作指针警告diss
22503 #pragma warning(disable:26490)//reinterpret_cast警告diss
22504 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
22505 #pragma warning(disable:26482)//非常数数组索引警告diss
22506 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
22507 #endif
22508 #if defined(_MSC_VER)
22509 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
22510 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
22511 #define push_msvc_warning() __pragma(warning(push))
22512 #define pop_msvc_warning() __pragma(warning(pop))
22513 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
22514 #else
22515 #define suppress_msvc_warning(...)
22516 #define disable_msvc_warning(...)
22517 #define push_msvc_warning()
22518 #define pop_msvc_warning()
22519 #define push_and_disable_msvc_warning(...)
22520 #endif
22521 //
22522 #if defined(ELC_VOID_NAME)
22523 #undef void
22524 #endif
22525
22526 // #define often_noexcept
22527 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
22528 #define noexcept_as_auto MAGIC//哦现在有了
22529 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
22530 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
22531
22532 #define using_method_from_base_t(name,...) \
22533 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
22534 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
22535 {\
22536 return base_t::name(forward<Args>(rest)...);\
22537 }\
22538
22539 #define using_method_from_value(name,value_name,...) \
22540 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
22541 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
22542 {\
22543 return value_name.name(forward<Args>(rest)...);\
22544 }\
22545
22546 #define floop while(__builtin_is_my_dick_still_there())
22547 #define enable_adl(name) void name()noexcept=delete
22548
22549 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
22550 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
22551
22552 #define declvalue(...) (::std::declval<__VA_ARGS__>())
22553
22554 /*实例化到此将引发错误*/
22555 #define template_error(reason) static_assert(template_error_helper<T>,reason)
22556 /*实例化到此将引发警告*/
22557 #define template_warning(reason) template_warning_helper<T>(reason)
22558
22559 //for type_info
22560 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
22561 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
22562
22563 #define is_common_attribute(name) public attribute<T,name<T>>
22564 #define is_special_attribute(name) public attribute<T,name>
22565
22566 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
22567 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
22568
22569 //for float_size_t
22570 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
22571 //bitnum_of
22572 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
22573
22574 //for attribute
22575 #define def_common_attribute_with_nothing(name) \
22576 template<typename T>\
22577 class name{}\
22578
22579 #define def_special_attribute_with_nothing(name) \
22580 class name{}\
22581
22582 #define common_attribute_t template<class>class
22583 #define special_attribute_t class
22584
22585 /*
22586 若参数的布尔值为零,那么此模板不会实例化
22587
22588 为什么不用cpp20的constraints?
22589 1.不能类内定义
22590 2.不能作为模板参数
22591 一句话总结:c艹标准会sb
22592 */
22593 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
22594 /*默认参与模板候选*/
22595 #define enabled_by_default class enable_state=void
22596 /*默认不参与模板候选*/
22597 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
22598 /*若参数为病式,那么此模板不会实例化*/
22599 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
22600 /*用于模板声明*/
22601 #define enable_flag class enable_state
22602
22603 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
22604 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
22605 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
22606 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
22607 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
22608
22609 /*让lambda递归更加美观*/
22610 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
22611 /*让lambda递归更加美观*/
22612 #define get_recursive_lambda_caller(name) \
22613 lambda_with_catch(&)(auto&&...Args){\
22614 return name(name,Args...);\
22615 }
22616 /*让lambda定义更加美观*/
22617 #define lambda []
22618 /*让lambda定义更加美观*/
22619 #define lambda_with_catch(...) [__VA_ARGS__]
22620 /*让lambda递归更加美观*/
22621 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
22622 //recursive_lambda_self_referential_reserved_symbolname
22623 #define lambda_RLSRRS _my_jb_super_sb_name_
22624
22625 #define MAGIC//ahh,ko no tenno da!
22626
22627 /*装饰性语法糖*/
22628 #define nothing
22629
22630 /*aya风格语法糖*/
22631 #define elseif else if
22632 /*aya风格语法糖*/
22633 #define _big_than_ >
22634 /*aya风格语法糖*/
22635 #define _small_than_ <
22636
22637 #if defined(_MSC_VER)
22638 #define not !
22639 #define and &&
22640 #define or ||
22641 #endif
22642
22643 /*进入名称空间,并不是很美观*/
22644 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
22645 /*退出名称空间,并不是很美观*/
22646 #define BREAK_NAMESPACE }
22647
22648 /*template说明符*/
22649 #define template_name template
22650 /*template说明符*/
22651 #define type_name class
22652
22653 #if defined(DEBUG) || defined(_DEBUG)
22654 #define not_in_debug 0
22655 #else
22656 #define not_in_debug 1
22657 #endif
22658
22659 #define es U""
22660 #define ec(ch) U ## ch
22661
22662 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
22663 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
22664 #else
22665 #define ELC_TEST_EVENTNAME(name)
22666 #endif
22667
22668 #define override_instance_struct \
22669 protected:\
22670 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
22671 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
22672 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
22673 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
22674 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
22675
22676 #if defined(_WIN32)
22677 #define distinctive __declspec(dllexport)
22678 #else
22679 #define distinctive
22680 #endif
22681
22682 #if defined(_WIN32)
22683 #define force_inline __forceinline
22684 #elif defined(__GNUC__)
22685 #define force_inline __attribute__((always_inline)) inline
22686 #else
22687 #define force_inline inline
22688 #endif
22689
22690 #if defined(_WIN32)
22691 #define with_no_vtable __declspec(novtable)
22692 #else
22693 #define with_no_vtable
22694 #endif
22695
22696 #define in_consteval (::std::is_constant_evaluated())
22697
22698 #define no_vtable_struct struct with_no_vtable
22699 #define no_vtable_class class with_no_vtable
22700
22701 //file_end
22702
22703 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
22704
22705 //file_end
22706
22707 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/_body.hpp"
22708
22709 namespace stream_n{
22710 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/memory_stream.hpp"
22711 //memory_stream.hpp
22712 //at namespace elc::defs
22713 /*
22714 未完成的elc解释器memory_stream文件
22715 由steve02081504与Alex0125设计、编写
22716 转载时请在不对此文件做任何修改的同时注明出处
22717 项目地址:https://github.com/steve02081504/ELC
22718 */
22720 byte* _m;
22721 size_t _s;
22722 size_t _pos;
22723 memory_stream()noexcept{
22724 _m = get<byte>[1024]();
22725 _pos = 0;
22726 _s = 0;
22727 }
22728 ~memory_stream()noexcept{
22729 unget(_m);
22730 }
22731 [[nodiscard]]size_t bufsize()const noexcept{
22732 return get_size_of_get(_m);
22733 }
22734 virtual void* seek(seek_type st,int_t offsize)noexcept override{
22735 switch(st){
22736 case beg:
22737 _pos = 0;
22738 return _m;
22739 case cur:
22740 _pos += (ptrdiff_t)offsize;
22741 return _m + _pos;
22742 case end:
22743 _pos = _s;
22744 return _m+_pos;
22745 default:
22746 return nullptr;
22747 }
22748 }
22749 virtual void seek_to(void*p)noexcept override{
22750 _pos = ((byte*)p)-_m;
22751 }
22752 virtual void sync()noexcept override{
22753 //do nothing
22754 }
22755 virtual void flush()noexcept override{
22756 //do nothing
22757 }
22758 virtual void close()noexcept override{
22759 unget(_m);
22760 _m = nullptr;
22761 _s = 0;
22762 }
22763 virtual void write(const byte*buf,size_t size)noexcept override{
22764 if(size>this->bufsize()-_pos)
22765 get_resize(_m,get_next_gold_size_to_resize_for_array(_pos+size));
22766 ::std::memcpy(_m+_pos,buf,size);
22767 _pos += size;
22768 _s = max(_pos,_s);
22769 }
22770 virtual size_t read(byte*buf,size_t size)noexcept override{
22771 if(_pos+size>_s)
22772 size = _s-_pos;
22773 ::std::memcpy(buf,_m+_pos,size);
22774 _pos += size;
22775 return size;
22776 }
22777 };
22778
22779 //file_end
22780
22781 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/_body.hpp"
22782 }
22783
22784 #if defined(ELC_TEST_ON)
22785 namespace memory_stream_part_test{
22786 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/_test.hpp"
22787 //_test.hpp
22788 /*
22789 未完成的elc解释器memory_stream文件
22790 由steve02081504与Alex0125设计、编写
22791 转载时请在不对此文件做任何修改的同时注明出处
22792 项目地址:https://github.com/steve02081504/ELC
22793 */
22794 inline void test(){
22795 ELC_TEST_EVENTNAME("memory_stream部分测试");
22796 }
22797 inline void test_log_out(){
22798 }
22799 inline void test_end(){
22800 }
22801
22802 //file_end
22803
22804 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/_body.hpp"
22805 }
22806 #endif
22807
22808 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
22809 //_undefs.hpp
22810 /*
22811 未完成的elc解释器basic文件
22812 由steve02081504与Alex0125设计、编写
22813 转载时请在不对此文件做任何修改的同时注明出处
22814 项目地址:https://github.com/steve02081504/ELC
22815 */
22816 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
22817 //_undefs.hpp
22818 /*
22819 未完成的elc解释器_share文件
22820 由steve02081504与Alex0125设计、编写
22821 转载时请在不对此文件做任何修改的同时注明出处
22822 项目地址:https://github.com/steve02081504/ELC
22823 */
22824
22825 //defs at "_defs.hpp"
22826
22827 #if defined(_MSC_VER)
22828 #pragma warning(pop)
22829 #endif
22830 #undef suppress_msvc_warning
22831 #undef disable_msvc_warning
22832 #undef push_msvc_warning
22833 #undef pop_msvc_warning
22834 #undef push_and_disable_msvc_warning
22835
22836 //for basic_environment.hpp
22837 #undef BIT_POSSIBILITY
22838 //
22839 #if defined(ELC_VOID_NAME)
22840 #define void the_void
22841 #endif
22842
22843 // #undef often_noexcept
22844 #undef noexcept_as
22845 #undef noexcept_as_auto
22846 #undef constexpr_as
22847 #undef constexpr_as_auto
22848
22849 #undef using_method_from_base_t
22850 #undef using_method_from_value
22851
22852 #undef floop
22853 #undef enable_adl
22854
22855 #undef re_declvalue
22856 #undef re_decltype
22857
22858 #undef declvalue
22859
22860 #undef template_error
22861 #undef template_warning
22862
22863 #undef type_info_of
22864 #undef type_name_of
22865
22866 #undef is_common_attribute
22867 #undef is_special_attribute
22868
22869 #undef has_attribute
22870 #undef not_has_attribute
22871
22872 #undef float_size_of
22873 #undef bitnum_of
22874
22875 #undef def_common_attribute_with_nothing
22876 #undef def_special_attribute_with_nothing
22877
22878 #undef common_attribute_t
22879 #undef special_attribute_t
22880
22881 #undef enable_if
22882 #undef enabled_by_default
22883 #undef disabled_by_default
22884 #undef enable_if_not_ill_form
22885 #undef enable_flag
22886
22887 #undef was_an_ill_form
22888 #undef was_an_ill_form_with_parameter
22889 #undef was_not_an_ill_form
22890 #undef was_not_an_ill_form_and_noexcept
22891 #undef was_not_an_ill_form_with_parameter
22892
22893 #undef recursive_lambda
22894 #undef get_recursive_lambda_caller
22895 #undef lambda
22896 #undef lambda_with_catch
22897 #undef self_recursion
22898 #undef lambda_RLSRRS
22899
22900 #undef MAGIC
22901
22902 #undef nothing
22903
22904 #undef elseif
22905 #undef _big_than_
22906 #undef _small_than_
22907
22908 #if defined(_MSC_VER)
22909 #undef not
22910 #undef and
22911 #undef or
22912 #endif
22913
22914 #undef INTER_NAMESPACE
22915 #undef BREAK_NAMESPACE
22916
22917 #undef szie
22918 #undef form
22919
22920 #undef template_name
22921 #undef type_name
22922
22923 #undef not_in_debug
22924
22925 #undef es
22926 #undef ec
22927
22928 #undef ELC_TEST_EVENTNAME
22929
22930 #undef override_instance_struct
22931
22932 #undef distinctive
22933
22934 #undef force_inline
22935
22936 #undef with_no_vtable
22937
22938 #undef in_consteval
22939
22940 #undef no_vtable_struct
22941 #undef no_vtable_class
22942
22943 //file_end
22944
22945 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
22946
22947 //file_end
22948
22949 #line 25 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/_body.hpp"
22950 }
22951 namespace elc{
22952 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/_export.hpp"
22953 //_export.hpp
22954 //at namespace elc
22955 /*
22956 未完成的elc解释器memory_stream文件
22957 由steve02081504与Alex0125设计、编写
22958 转载时请在不对此文件做任何修改的同时注明出处
22959 项目地址:https://github.com/steve02081504/ELC
22960 */
22961 #define export using defs::
22962 export memory_stream;
22963 #undef export
22964
22965 //file_end
22966
22967 #line 28 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/memory_stream/_body.hpp"
22968 }
22969
22970 //file_end
22971
22972 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/memory_stream"
22973 #endif
22974
22975 //file_end
22976
22977 #line 20 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
22978 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/namespace"
22979 //namespace
22980 //at namespace ::
22981 /*
22982 未完成的elc解释器include文件
22983 由steve02081504与Alex0125设计、编写
22984 转载时请在不对此文件做任何修改的同时注明出处
22985 项目地址:https://github.com/steve02081504/ELC
22986 */
22987 #if !defined(ELC_NAMESPACE)
22988 #define ELC_NAMESPACE
22989 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
22990 //core
22991 //at namespace ::
22992 /*
22993 未完成的elc解释器include文件
22994 由steve02081504与Alex0125设计、编写
22995 转载时请在不对此文件做任何修改的同时注明出处
22996 项目地址:https://github.com/steve02081504/ELC
22997 */
22998 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
22999
23000 //file_end
23001
23002 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/namespace"
23003 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
23004 //string
23005 //at namespace ::
23006 /*
23007 未完成的elc解释器include文件
23008 由steve02081504与Alex0125设计、编写
23009 转载时请在不对此文件做任何修改的同时注明出处
23010 项目地址:https://github.com/steve02081504/ELC
23011 */
23012 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
23013
23014 //file_end
23015
23016 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/namespace"
23017 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/_body.hpp"
23018 //_body.hpp
23019 //at namespace ::
23020 /*
23021 未完成的elc解释器namespace文件
23022 由steve02081504与Alex0125设计、编写
23023 转载时请在不对此文件做任何修改的同时注明出处
23024 项目地址:https://github.com/steve02081504/ELC
23025 */
23026 #if defined(ELC_TEST)
23027 #error "this part cannot be tested."
23028 #endif
23029 namespace elc::defs{
23030 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
23031 //_defs.hpp
23032 /*
23033 未完成的elc解释器basic文件
23034 由steve02081504与Alex0125设计、编写
23035 转载时请在不对此文件做任何修改的同时注明出处
23036 项目地址:https://github.com/steve02081504/ELC
23037 */
23038 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
23039 //_defs.hpp
23040 /*
23041 未完成的elc解释器_share文件
23042 由steve02081504与Alex0125设计、编写
23043 转载时请在不对此文件做任何修改的同时注明出处
23044 项目地址:https://github.com/steve02081504/ELC
23045 */
23046
23047 //undefs at "_undefs.hpp"
23048
23049 //set ELC_WARNING_LEVEL default to 4(max)
23050 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
23051
23052 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
23053 //basic_environment.hpp
23054 /*
23055 未完成的elc解释器_share文件
23056 由steve02081504与Alex0125设计、编写
23057 转载时请在不对此文件做任何修改的同时注明出处
23058 项目地址:https://github.com/steve02081504/ELC
23059 */
23060
23061 //每个bit(不是字节)的可能性
23062 //为什么c艹委员会不定义这个?
23063 #define BIT_POSSIBILITY 2
23064
23065 //file_end
23066
23067 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
23068
23069 #if defined(_MSC_VER)
23070 #pragma warning(push,ELC_WARNING_LEVEL)
23071 #pragma warning(disable:4099)//class与struct混用警告diss
23072 #pragma warning(disable:26812)//enum class安利diss.
23073 #pragma warning(disable:4584)//重复子类警告diss
23074 #pragma warning(disable:4250)//域控制继承警告diss
23075 #pragma warning(disable:26432)//不完全默认方法警告diss
23076 #pragma warning(disable:26435)//virtual override方法警告diss
23077 #pragma warning(disable:26481)//容器安利diss
23078 #pragma warning(disable:26446)//gsl::at安利diss
23079 #pragma warning(disable:26434)//方法覆盖警告diss
23080 #pragma warning(disable:26429)//gsl::not_null安利diss
23081 #pragma warning(disable:26471)//对void*进行static_cast安利diss
23082 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
23083 #pragma warning(disable:26473)//相同指针显式cast警告diss
23084 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
23085 #pragma warning(disable:26485)//数组作指针警告diss
23086 #pragma warning(disable:26490)//reinterpret_cast警告diss
23087 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
23088 #pragma warning(disable:26482)//非常数数组索引警告diss
23089 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
23090 #endif
23091 #if defined(_MSC_VER)
23092 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
23093 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
23094 #define push_msvc_warning() __pragma(warning(push))
23095 #define pop_msvc_warning() __pragma(warning(pop))
23096 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
23097 #else
23098 #define suppress_msvc_warning(...)
23099 #define disable_msvc_warning(...)
23100 #define push_msvc_warning()
23101 #define pop_msvc_warning()
23102 #define push_and_disable_msvc_warning(...)
23103 #endif
23104 //
23105 #if defined(ELC_VOID_NAME)
23106 #undef void
23107 #endif
23108
23109 // #define often_noexcept
23110 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
23111 #define noexcept_as_auto MAGIC//哦现在有了
23112 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
23113 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
23114
23115 #define using_method_from_base_t(name,...) \
23116 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
23117 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
23118 {\
23119 return base_t::name(forward<Args>(rest)...);\
23120 }\
23121
23122 #define using_method_from_value(name,value_name,...) \
23123 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
23124 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
23125 {\
23126 return value_name.name(forward<Args>(rest)...);\
23127 }\
23128
23129 #define floop while(__builtin_is_my_dick_still_there())
23130 #define enable_adl(name) void name()noexcept=delete
23131
23132 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
23133 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
23134
23135 #define declvalue(...) (::std::declval<__VA_ARGS__>())
23136
23137 /*实例化到此将引发错误*/
23138 #define template_error(reason) static_assert(template_error_helper<T>,reason)
23139 /*实例化到此将引发警告*/
23140 #define template_warning(reason) template_warning_helper<T>(reason)
23141
23142 //for type_info
23143 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
23144 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
23145
23146 #define is_common_attribute(name) public attribute<T,name<T>>
23147 #define is_special_attribute(name) public attribute<T,name>
23148
23149 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
23150 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
23151
23152 //for float_size_t
23153 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
23154 //bitnum_of
23155 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
23156
23157 //for attribute
23158 #define def_common_attribute_with_nothing(name) \
23159 template<typename T>\
23160 class name{}\
23161
23162 #define def_special_attribute_with_nothing(name) \
23163 class name{}\
23164
23165 #define common_attribute_t template<class>class
23166 #define special_attribute_t class
23167
23168 /*
23169 若参数的布尔值为零,那么此模板不会实例化
23170
23171 为什么不用cpp20的constraints?
23172 1.不能类内定义
23173 2.不能作为模板参数
23174 一句话总结:c艹标准会sb
23175 */
23176 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
23177 /*默认参与模板候选*/
23178 #define enabled_by_default class enable_state=void
23179 /*默认不参与模板候选*/
23180 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
23181 /*若参数为病式,那么此模板不会实例化*/
23182 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
23183 /*用于模板声明*/
23184 #define enable_flag class enable_state
23185
23186 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
23187 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
23188 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
23189 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
23190 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
23191
23192 /*让lambda递归更加美观*/
23193 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
23194 /*让lambda递归更加美观*/
23195 #define get_recursive_lambda_caller(name) \
23196 lambda_with_catch(&)(auto&&...Args){\
23197 return name(name,Args...);\
23198 }
23199 /*让lambda定义更加美观*/
23200 #define lambda []
23201 /*让lambda定义更加美观*/
23202 #define lambda_with_catch(...) [__VA_ARGS__]
23203 /*让lambda递归更加美观*/
23204 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
23205 //recursive_lambda_self_referential_reserved_symbolname
23206 #define lambda_RLSRRS _my_jb_super_sb_name_
23207
23208 #define MAGIC//ahh,ko no tenno da!
23209
23210 /*装饰性语法糖*/
23211 #define nothing
23212
23213 /*aya风格语法糖*/
23214 #define elseif else if
23215 /*aya风格语法糖*/
23216 #define _big_than_ >
23217 /*aya风格语法糖*/
23218 #define _small_than_ <
23219
23220 #if defined(_MSC_VER)
23221 #define not !
23222 #define and &&
23223 #define or ||
23224 #endif
23225
23226 /*进入名称空间,并不是很美观*/
23227 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
23228 /*退出名称空间,并不是很美观*/
23229 #define BREAK_NAMESPACE }
23230
23231 /*template说明符*/
23232 #define template_name template
23233 /*template说明符*/
23234 #define type_name class
23235
23236 #if defined(DEBUG) || defined(_DEBUG)
23237 #define not_in_debug 0
23238 #else
23239 #define not_in_debug 1
23240 #endif
23241
23242 #define es U""
23243 #define ec(ch) U ## ch
23244
23245 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
23246 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
23247 #else
23248 #define ELC_TEST_EVENTNAME(name)
23249 #endif
23250
23251 #define override_instance_struct \
23252 protected:\
23253 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
23254 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
23255 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
23256 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
23257 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
23258
23259 #if defined(_WIN32)
23260 #define distinctive __declspec(dllexport)
23261 #else
23262 #define distinctive
23263 #endif
23264
23265 #if defined(_WIN32)
23266 #define force_inline __forceinline
23267 #elif defined(__GNUC__)
23268 #define force_inline __attribute__((always_inline)) inline
23269 #else
23270 #define force_inline inline
23271 #endif
23272
23273 #if defined(_WIN32)
23274 #define with_no_vtable __declspec(novtable)
23275 #else
23276 #define with_no_vtable
23277 #endif
23278
23279 #define in_consteval (::std::is_constant_evaluated())
23280
23281 #define no_vtable_struct struct with_no_vtable
23282 #define no_vtable_class class with_no_vtable
23283
23284 //file_end
23285
23286 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
23287
23288 //file_end
23289
23290 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/_body.hpp"
23291
23292 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/defs.hpp"
23293 //defs.hpp
23294 /*
23295 未完成的elc解释器namespace文件
23296 由steve02081504与Alex0125设计、编写
23297 转载时请在不对此文件做任何修改的同时注明出处
23298 项目地址:https://github.com/steve02081504/ELC
23299 */
23300 namespace core{
23301 template<>
23302 distinctive inline map_t<ptr,string> long_term_binary_node_storager<string>{};
23303 }
23304 namespace namespace_n{
23305 distinctive inline struct namespace_t{
23306 ptr _namespace_root;
23307 weak_ptr _namespace_now;
23308 value get_symbol_type_map(ptr thenamespace){
23309 return (*thenamespace)[es".symbol_type_map"];
23310 }
23311 namespace_t()noexcept{
23312 _namespace_root = get<common_node>();
23313 auto&nmsp = *_namespace_root;
23314 _namespace_now = &nmsp;
23315 push_and_disable_msvc_warning(26447);//may throw警告diss
23316 nmsp[es".."] = the_void;
23317 nmsp[es"."] = nmsp;
23318 nmsp[es"t"] = t;
23319 nmsp[es"nil"] = nil;
23320 nmsp[es"void"] = the_void;
23321 value nmsptm = get_symbol_type_map(&nmsp);
23322 nmsptm = get<common_node>();
23323 nmsptm[es"void"] = es"void";
23324 pop_msvc_warning();
23325 }
23326 ptr get_symbol_namespace(const value index){
23327 ptr namespace_now_p = _namespace_now;
23328 while(namespace_now_p && !(*namespace_now_p)[index] && !get_symbol_type_map(namespace_now_p)[index])
23329 namespace_now_p = (*namespace_now_p)[es".."];
23330 return namespace_now_p;
23331 }
23332 ptr get_symbol_namespace(auto&& index){ return get_symbol_namespace(as_value(index)); }
23333 bool has_symbol(const value index){
23334 auto nmsp=get_symbol_namespace(index);
23335 if((*nmsp)[index] || get_symbol_type_map(nmsp)[index])
23336 return true;
23337 return false;
23338 }
23339 bool has_symbol(auto&& index){ return has_symbol(as_value(index)); }
23340 value get_symbol(const value index){
23341 return (*get_symbol_namespace(index))[index];
23342 }
23343 value get_symbol(auto&& index){ return get_symbol(as_value(index)); }
23344 value get_symbol_type(const value index){
23345 return get_symbol_type_map(get_symbol_namespace(index))[index];
23346 }
23347 value get_symbol_type(auto&& index){ return get_symbol_type(as_value(index)); }
23348
23349 void inter_namespace(const value namespace_name){
23350 _namespace_now = get_symbol(namespace_name);
23351 }
23352 void inter_namespace(auto&& index){ inter_namespace(as_value(index)); }
23353
23354 void leave_namespace(){ inter_namespace(es".."); }
23355 }names{};
23356 }
23357
23358 //file_end
23359
23360 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/_body.hpp"
23361
23362 #if defined(ELC_TEST_ON)
23363 namespace namespace_part_test{
23364 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/_test.hpp"
23365 //_test.hpp
23366 /*
23367 未完成的elc解释器namespace文件
23368 由steve02081504与Alex0125设计、编写
23369 转载时请在不对此文件做任何修改的同时注明出处
23370 项目地址:https://github.com/steve02081504/ELC
23371 */
23372 inline void test(){
23373 ELC_TEST_EVENTNAME("namespace部分测试");
23374 }
23375 inline void test_log_out(){
23376 }
23377 inline void test_end{
23378 }
23379
23380 //file_end
23381
23382 #line 19 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/_body.hpp"
23383 }
23384 #endif
23385
23386 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
23387 //_undefs.hpp
23388 /*
23389 未完成的elc解释器basic文件
23390 由steve02081504与Alex0125设计、编写
23391 转载时请在不对此文件做任何修改的同时注明出处
23392 项目地址:https://github.com/steve02081504/ELC
23393 */
23394 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
23395 //_undefs.hpp
23396 /*
23397 未完成的elc解释器_share文件
23398 由steve02081504与Alex0125设计、编写
23399 转载时请在不对此文件做任何修改的同时注明出处
23400 项目地址:https://github.com/steve02081504/ELC
23401 */
23402
23403 //defs at "_defs.hpp"
23404
23405 #if defined(_MSC_VER)
23406 #pragma warning(pop)
23407 #endif
23408 #undef suppress_msvc_warning
23409 #undef disable_msvc_warning
23410 #undef push_msvc_warning
23411 #undef pop_msvc_warning
23412 #undef push_and_disable_msvc_warning
23413
23414 //for basic_environment.hpp
23415 #undef BIT_POSSIBILITY
23416 //
23417 #if defined(ELC_VOID_NAME)
23418 #define void the_void
23419 #endif
23420
23421 // #undef often_noexcept
23422 #undef noexcept_as
23423 #undef noexcept_as_auto
23424 #undef constexpr_as
23425 #undef constexpr_as_auto
23426
23427 #undef using_method_from_base_t
23428 #undef using_method_from_value
23429
23430 #undef floop
23431 #undef enable_adl
23432
23433 #undef re_declvalue
23434 #undef re_decltype
23435
23436 #undef declvalue
23437
23438 #undef template_error
23439 #undef template_warning
23440
23441 #undef type_info_of
23442 #undef type_name_of
23443
23444 #undef is_common_attribute
23445 #undef is_special_attribute
23446
23447 #undef has_attribute
23448 #undef not_has_attribute
23449
23450 #undef float_size_of
23451 #undef bitnum_of
23452
23453 #undef def_common_attribute_with_nothing
23454 #undef def_special_attribute_with_nothing
23455
23456 #undef common_attribute_t
23457 #undef special_attribute_t
23458
23459 #undef enable_if
23460 #undef enabled_by_default
23461 #undef disabled_by_default
23462 #undef enable_if_not_ill_form
23463 #undef enable_flag
23464
23465 #undef was_an_ill_form
23466 #undef was_an_ill_form_with_parameter
23467 #undef was_not_an_ill_form
23468 #undef was_not_an_ill_form_and_noexcept
23469 #undef was_not_an_ill_form_with_parameter
23470
23471 #undef recursive_lambda
23472 #undef get_recursive_lambda_caller
23473 #undef lambda
23474 #undef lambda_with_catch
23475 #undef self_recursion
23476 #undef lambda_RLSRRS
23477
23478 #undef MAGIC
23479
23480 #undef nothing
23481
23482 #undef elseif
23483 #undef _big_than_
23484 #undef _small_than_
23485
23486 #if defined(_MSC_VER)
23487 #undef not
23488 #undef and
23489 #undef or
23490 #endif
23491
23492 #undef INTER_NAMESPACE
23493 #undef BREAK_NAMESPACE
23494
23495 #undef szie
23496 #undef form
23497
23498 #undef template_name
23499 #undef type_name
23500
23501 #undef not_in_debug
23502
23503 #undef es
23504 #undef ec
23505
23506 #undef ELC_TEST_EVENTNAME
23507
23508 #undef override_instance_struct
23509
23510 #undef distinctive
23511
23512 #undef force_inline
23513
23514 #undef with_no_vtable
23515
23516 #undef in_consteval
23517
23518 #undef no_vtable_struct
23519 #undef no_vtable_class
23520
23521 //file_end
23522
23523 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
23524
23525 //file_end
23526
23527 #line 23 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/_body.hpp"
23528 }
23529 namespace elc{
23530 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/_export.hpp"
23531 //_export.hpp
23532 //at namespace elc
23533 /*
23534 未完成的elc解释器namespace文件
23535 由steve02081504与Alex0125设计、编写
23536 转载时请在不对此文件做任何修改的同时注明出处
23537 项目地址:https://github.com/steve02081504/ELC
23538 */
23539 #define export using defs::
23540 export namespace_n::names;
23541 #undef export
23542
23543 //file_end
23544
23545 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/namespace/_body.hpp"
23546 }
23547
23548 //file_end
23549
23550 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/namespace"
23551 #endif
23552
23553 //file_end
23554
23555 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
23556 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/numerical_representation"
23557 //numerical_representation
23558 //at namespace ::
23559 /*
23560 未完成的elc解释器include文件
23561 由steve02081504与Alex0125设计、编写
23562 转载时请在不对此文件做任何修改的同时注明出处
23563 项目地址:https://github.com/steve02081504/ELC
23564 */
23565 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/numerical_representation"
23566
23567 //file_end
23568
23569 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
23570 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/package_symbol_loader"
23571 //lib_loader
23572 //at namespace ::
23573 /*
23574 未完成的elc解释器include文件
23575 由steve02081504与Alex0125设计、编写
23576 转载时请在不对此文件做任何修改的同时注明出处
23577 项目地址:https://github.com/steve02081504/ELC
23578 */
23579 #if !defined(ELC_PACKAGE_SYMBOL_LOADER)
23580 #define ELC_PACKAGE_SYMBOL_LOADER
23581 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
23582 //core
23583 //at namespace ::
23584 /*
23585 未完成的elc解释器include文件
23586 由steve02081504与Alex0125设计、编写
23587 转载时请在不对此文件做任何修改的同时注明出处
23588 项目地址:https://github.com/steve02081504/ELC
23589 */
23590 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/core"
23591
23592 //file_end
23593
23594 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/package_symbol_loader"
23595 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
23596 //string
23597 //at namespace ::
23598 /*
23599 未完成的elc解释器include文件
23600 由steve02081504与Alex0125设计、编写
23601 转载时请在不对此文件做任何修改的同时注明出处
23602 项目地址:https://github.com/steve02081504/ELC
23603 */
23604 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
23605
23606 //file_end
23607
23608 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/package_symbol_loader"
23609 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/lib_loader"
23610 //lib_loader
23611 //at namespace ::
23612 /*
23613 未完成的elc解释器include文件
23614 由steve02081504与Alex0125设计、编写
23615 转载时请在不对此文件做任何修改的同时注明出处
23616 项目地址:https://github.com/steve02081504/ELC
23617 */
23618 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/lib_loader"
23619
23620 //file_end
23621
23622 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/package_symbol_loader"
23623 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_body.hpp"
23624 //_body.hpp
23625 //at namespace ::
23626 /*
23627 未完成的elc解释器template文件
23628 由steve02081504与Alex0125设计、编写
23629 转载时请在不对此文件做任何修改的同时注明出处
23630 项目地址:https://github.com/steve02081504/ELC
23631 */
23632 #if defined(ELC_TEST)
23633 #error "this part cannot be tested."
23634 #endif
23635 //include locale:自然语言相关的字符串
23636 //strings
23637 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
23638 //using.hpp
23639 /*
23640 未完成的elc解释器_share文件
23641 由steve02081504与Alex0125设计、编写
23642 转载时请在不对此文件做任何修改的同时注明出处
23643 项目地址:https://github.com/steve02081504/ELC
23644 */
23645 /*
23646 locale说明
23647 elc使用的字符串.
23648 调整这些,实现快速本地化.
23649 */
23650 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/locale/using.hpp"
23651
23652 //file_end
23653
23654 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_body.hpp"
23655 //include paths:获取package_symbol_loader的实际位置
23656 //package_symbol_loader_path
23657 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/paths.hpp"
23658 //paths.hpp
23659 /*
23660 未完成的elc解释器_share文件
23661 由steve02081504与Alex0125设计、编写
23662 转载时请在不对此文件做任何修改的同时注明出处
23663 项目地址:https://github.com/steve02081504/ELC
23664 */
23665 #if !defined(ELC_PATHS)
23666 #define ELC_PATHS
23667 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
23668 //base_defs
23669 //at namespace ::
23670 /*
23671 未完成的elc解释器include文件
23672 由steve02081504与Alex0125设计、编写
23673 转载时请在不对此文件做任何修改的同时注明出处
23674 项目地址:https://github.com/steve02081504/ELC
23675 */
23676 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base_defs"
23677
23678 //file_end
23679
23680 #line 10 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/paths.hpp"
23681 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
23682 //string
23683 //at namespace ::
23684 /*
23685 未完成的elc解释器include文件
23686 由steve02081504与Alex0125设计、编写
23687 转载时请在不对此文件做任何修改的同时注明出处
23688 项目地址:https://github.com/steve02081504/ELC
23689 */
23690 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
23691
23692 //file_end
23693
23694 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/paths.hpp"
23695 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
23696 //str_code_convert.hpp
23697 /*
23698 未完成的elc解释器_share文件
23699 由steve02081504与Alex0125设计、编写
23700 转载时请在不对此文件做任何修改的同时注明出处
23701 项目地址:https://github.com/steve02081504/ELC
23702 */
23703 /*
23704 APIs说明
23705 elc依赖的基础函数.
23706 调整这些,实现快速移植,快速优化与行为自定义.
23707 */
23708 #line 70 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/str_code_convert.hpp"
23709
23710 //file_end
23711
23712 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/paths.hpp"
23713 //
23714 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/_tools/decl_system_type.hpp"
23715 //decl_system_type.hpp
23716 /*
23717 未完成的elc解释器_share文件
23718 由steve02081504与Alex0125设计、编写
23719 转载时请在不对此文件做任何修改的同时注明出处
23720 项目地址:https://github.com/steve02081504/ELC
23721 */
23722 //copy&rewrite from steve02081504/steve.h
23723 #define linux 2
23724 #define windows 3
23725 #define other 4
23726 #if defined(__linux)||defined(__linux__)||defined(__gnu_linux__)
23727 #define SYSTEM_TYPE linux
23728 #elif defined(_WIN32)||defined(__MINGW32__)||defined(__CYGWIN__)
23729 #define SYSTEM_TYPE windows
23730 #else
23731 #define SYSTEM_TYPE other
23732 #endif
23733 #define ERROR_MSG_UNABLE_OS "Unable OS,edit this file on your own or contact ELC's producers."
23734
23735 //file_end
23736
23737 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/paths.hpp"
23738 //
23739 #if SYSTEM_TYPE == windows
23740 #include <shlobj_core.h>
23741 #elif SYSTEM_TYPE == linux
23742 #include <unistd.h>
23743 #else
23744 #include <cstdio>
23745 #endif
23746 //
23747 namespace elc::paths{
23748 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
23749 //_defs.hpp
23750 /*
23751 未完成的elc解释器_share文件
23752 由steve02081504与Alex0125设计、编写
23753 转载时请在不对此文件做任何修改的同时注明出处
23754 项目地址:https://github.com/steve02081504/ELC
23755 */
23756
23757 //undefs at "_undefs.hpp"
23758
23759 //set ELC_WARNING_LEVEL default to 4(max)
23760 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
23761
23762 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
23763 //basic_environment.hpp
23764 /*
23765 未完成的elc解释器_share文件
23766 由steve02081504与Alex0125设计、编写
23767 转载时请在不对此文件做任何修改的同时注明出处
23768 项目地址:https://github.com/steve02081504/ELC
23769 */
23770
23771 //每个bit(不是字节)的可能性
23772 //为什么c艹委员会不定义这个?
23773 #define BIT_POSSIBILITY 2
23774
23775 //file_end
23776
23777 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
23778
23779 #if defined(_MSC_VER)
23780 #pragma warning(push,ELC_WARNING_LEVEL)
23781 #pragma warning(disable:4099)//class与struct混用警告diss
23782 #pragma warning(disable:26812)//enum class安利diss.
23783 #pragma warning(disable:4584)//重复子类警告diss
23784 #pragma warning(disable:4250)//域控制继承警告diss
23785 #pragma warning(disable:26432)//不完全默认方法警告diss
23786 #pragma warning(disable:26435)//virtual override方法警告diss
23787 #pragma warning(disable:26481)//容器安利diss
23788 #pragma warning(disable:26446)//gsl::at安利diss
23789 #pragma warning(disable:26434)//方法覆盖警告diss
23790 #pragma warning(disable:26429)//gsl::not_null安利diss
23791 #pragma warning(disable:26471)//对void*进行static_cast安利diss
23792 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
23793 #pragma warning(disable:26473)//相同指针显式cast警告diss
23794 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
23795 #pragma warning(disable:26485)//数组作指针警告diss
23796 #pragma warning(disable:26490)//reinterpret_cast警告diss
23797 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
23798 #pragma warning(disable:26482)//非常数数组索引警告diss
23799 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
23800 #endif
23801 #if defined(_MSC_VER)
23802 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
23803 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
23804 #define push_msvc_warning() __pragma(warning(push))
23805 #define pop_msvc_warning() __pragma(warning(pop))
23806 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
23807 #else
23808 #define suppress_msvc_warning(...)
23809 #define disable_msvc_warning(...)
23810 #define push_msvc_warning()
23811 #define pop_msvc_warning()
23812 #define push_and_disable_msvc_warning(...)
23813 #endif
23814 //
23815 #if defined(ELC_VOID_NAME)
23816 #undef void
23817 #endif
23818
23819 // #define often_noexcept
23820 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
23821 #define noexcept_as_auto MAGIC//哦现在有了
23822 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
23823 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
23824
23825 #define using_method_from_base_t(name,...) \
23826 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
23827 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
23828 {\
23829 return base_t::name(forward<Args>(rest)...);\
23830 }\
23831
23832 #define using_method_from_value(name,value_name,...) \
23833 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
23834 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
23835 {\
23836 return value_name.name(forward<Args>(rest)...);\
23837 }\
23838
23839 #define floop while(__builtin_is_my_dick_still_there())
23840 #define enable_adl(name) void name()noexcept=delete
23841
23842 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
23843 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
23844
23845 #define declvalue(...) (::std::declval<__VA_ARGS__>())
23846
23847 /*实例化到此将引发错误*/
23848 #define template_error(reason) static_assert(template_error_helper<T>,reason)
23849 /*实例化到此将引发警告*/
23850 #define template_warning(reason) template_warning_helper<T>(reason)
23851
23852 //for type_info
23853 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
23854 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
23855
23856 #define is_common_attribute(name) public attribute<T,name<T>>
23857 #define is_special_attribute(name) public attribute<T,name>
23858
23859 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
23860 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
23861
23862 //for float_size_t
23863 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
23864 //bitnum_of
23865 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
23866
23867 //for attribute
23868 #define def_common_attribute_with_nothing(name) \
23869 template<typename T>\
23870 class name{}\
23871
23872 #define def_special_attribute_with_nothing(name) \
23873 class name{}\
23874
23875 #define common_attribute_t template<class>class
23876 #define special_attribute_t class
23877
23878 /*
23879 若参数的布尔值为零,那么此模板不会实例化
23880
23881 为什么不用cpp20的constraints?
23882 1.不能类内定义
23883 2.不能作为模板参数
23884 一句话总结:c艹标准会sb
23885 */
23886 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
23887 /*默认参与模板候选*/
23888 #define enabled_by_default class enable_state=void
23889 /*默认不参与模板候选*/
23890 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
23891 /*若参数为病式,那么此模板不会实例化*/
23892 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
23893 /*用于模板声明*/
23894 #define enable_flag class enable_state
23895
23896 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
23897 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
23898 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
23899 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
23900 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
23901
23902 /*让lambda递归更加美观*/
23903 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
23904 /*让lambda递归更加美观*/
23905 #define get_recursive_lambda_caller(name) \
23906 lambda_with_catch(&)(auto&&...Args){\
23907 return name(name,Args...);\
23908 }
23909 /*让lambda定义更加美观*/
23910 #define lambda []
23911 /*让lambda定义更加美观*/
23912 #define lambda_with_catch(...) [__VA_ARGS__]
23913 /*让lambda递归更加美观*/
23914 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
23915 //recursive_lambda_self_referential_reserved_symbolname
23916 #define lambda_RLSRRS _my_jb_super_sb_name_
23917
23918 #define MAGIC//ahh,ko no tenno da!
23919
23920 /*装饰性语法糖*/
23921 #define nothing
23922
23923 /*aya风格语法糖*/
23924 #define elseif else if
23925 /*aya风格语法糖*/
23926 #define _big_than_ >
23927 /*aya风格语法糖*/
23928 #define _small_than_ <
23929
23930 #if defined(_MSC_VER)
23931 #define not !
23932 #define and &&
23933 #define or ||
23934 #endif
23935
23936 /*进入名称空间,并不是很美观*/
23937 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
23938 /*退出名称空间,并不是很美观*/
23939 #define BREAK_NAMESPACE }
23940
23941 /*template说明符*/
23942 #define template_name template
23943 /*template说明符*/
23944 #define type_name class
23945
23946 #if defined(DEBUG) || defined(_DEBUG)
23947 #define not_in_debug 0
23948 #else
23949 #define not_in_debug 1
23950 #endif
23951
23952 #define es U""
23953 #define ec(ch) U ## ch
23954
23955 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
23956 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
23957 #else
23958 #define ELC_TEST_EVENTNAME(name)
23959 #endif
23960
23961 #define override_instance_struct \
23962 protected:\
23963 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
23964 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
23965 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
23966 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
23967 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
23968
23969 #if defined(_WIN32)
23970 #define distinctive __declspec(dllexport)
23971 #else
23972 #define distinctive
23973 #endif
23974
23975 #if defined(_WIN32)
23976 #define force_inline __forceinline
23977 #elif defined(__GNUC__)
23978 #define force_inline __attribute__((always_inline)) inline
23979 #else
23980 #define force_inline inline
23981 #endif
23982
23983 #if defined(_WIN32)
23984 #define with_no_vtable __declspec(novtable)
23985 #else
23986 #define with_no_vtable
23987 #endif
23988
23989 #define in_consteval (::std::is_constant_evaluated())
23990
23991 #define no_vtable_struct struct with_no_vtable
23992 #define no_vtable_class class with_no_vtable
23993
23994 //file_end
23995
23996 #line 25 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/paths.hpp"
23997
23998 using namespace ::elc::defs;
23999 namespace defs{
24000 #if SYSTEM_TYPE == windows
24001 #define DYNAMIC_LIBRARY_SUFFIX ".dll"
24002 #else
24003 #define DYNAMIC_LIBRARY_SUFFIX ".so"
24004 #endif
24005
24006 [[nodiscard]]inline bool file_exists(const string&name)noexcept{
24007 #if SYSTEM_TYPE == windows
24008 return GetFileAttributesA(to_char_str(name).c_str())!=INVALID_FILE_ATTRIBUTES;
24009 #elif SYSTEM_TYPE == linux
24010 return access(to_char_str(name).c_str(),F_OK)==0;
24011 #else
24012 auto fp = ::std::fopen(to_char_str(name).c_str(), "rb");
24013 if(fp){
24014 ::std::fclose(fp);
24015 return true;
24016 }
24017 return false;
24018 #endif
24019 }
24020 [[nodiscard]]inline string get_program_data_path()noexcept{
24021 #if SYSTEM_TYPE == windows
24022 char path[MAX_PATH];
24023 if(!SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_COMMON_APPDATA, NULL, 0, path)))
24024 return string{};
24025 return to_char_t_str(path);
24026 #elif SYSTEM_TYPE == linux
24027 return es"/usr/local/share"_constexpr_str;
24028 #else
24029 return string{};
24030 #endif
24031 }
24032 [[nodiscard]]inline string get_system_drive()noexcept{
24033 #if SYSTEM_TYPE == windows
24034 char path[MAX_PATH];
24035 if(!SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_WINDOWS, NULL, 0, path)))
24036 return string{};
24037 return to_char_t_str(path)+es"\\.."_constexpr_str;
24038 #elif SYSTEM_TYPE == linux
24039 return es"/"_constexpr_str;
24040 #else
24041 return string{};
24042 #endif
24043 }
24044 [[nodiscard]]inline string get_elc_runtime_lib_path()noexcept{
24045 #if SYSTEM_TYPE == windows
24046 //windows: if can read file ProgramData/elc/flag , use ProgramData/elc
24047 //else try to read SystemDrive/elc/flag , use ProgramData/elc
24048 //else return "./elc"
24049 {
24050 string program_data_path=get_program_data_path();
24051 if(program_data_path.size() && file_exists(program_data_path + es"/elc/flag"_constexpr_str))
24052 return program_data_path+es"/elc"_constexpr_str;
24053 }
24054 {
24055 string system_drive=get_system_drive();
24056 if(system_drive.size() && file_exists(system_drive + es"/elc/flag"_constexpr_str))
24057 return system_drive+es"/elc"_constexpr_str;
24058 }
24059 #elif SYSTEM_TYPE == linux
24060 //linux: if can read file /usr/lib/elc/flag , use /usr/lib/elc
24061 //else return "./elc"
24062 string flag_path=es"/usr/lib/elc/flag"_constexpr_str;
24063 if(file_exists(flag_path))
24064 return es"/usr/lib/elc"_constexpr_str;
24065 #endif
24066 return es"./elc"_constexpr_str;
24067 }
24068 }
24069 inline constexpr auto package_symbol_loader_file_name = es"package_symbol_loader" DYNAMIC_LIBRARY_SUFFIX ""_constexpr_str;
24070
24071 push_and_disable_msvc_warning(26426);//动态初始化警告diss
24072 distinctive inline string elc_runtime_lib_path=defs::get_elc_runtime_lib_path();
24073 distinctive inline string package_symbol_loader_path = elc_runtime_lib_path+es"/"_constexpr_str+package_symbol_loader_file_name;
24074 pop_msvc_warning();
24075
24076 #undef DYNAMIC_LIBRARY_SUFFIX
24077
24078 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
24079 //_undefs.hpp
24080 /*
24081 未完成的elc解释器_share文件
24082 由steve02081504与Alex0125设计、编写
24083 转载时请在不对此文件做任何修改的同时注明出处
24084 项目地址:https://github.com/steve02081504/ELC
24085 */
24086
24087 //defs at "_defs.hpp"
24088
24089 #if defined(_MSC_VER)
24090 #pragma warning(pop)
24091 #endif
24092 #undef suppress_msvc_warning
24093 #undef disable_msvc_warning
24094 #undef push_msvc_warning
24095 #undef pop_msvc_warning
24096 #undef push_and_disable_msvc_warning
24097
24098 //for basic_environment.hpp
24099 #undef BIT_POSSIBILITY
24100 //
24101 #if defined(ELC_VOID_NAME)
24102 #define void the_void
24103 #endif
24104
24105 // #undef often_noexcept
24106 #undef noexcept_as
24107 #undef noexcept_as_auto
24108 #undef constexpr_as
24109 #undef constexpr_as_auto
24110
24111 #undef using_method_from_base_t
24112 #undef using_method_from_value
24113
24114 #undef floop
24115 #undef enable_adl
24116
24117 #undef re_declvalue
24118 #undef re_decltype
24119
24120 #undef declvalue
24121
24122 #undef template_error
24123 #undef template_warning
24124
24125 #undef type_info_of
24126 #undef type_name_of
24127
24128 #undef is_common_attribute
24129 #undef is_special_attribute
24130
24131 #undef has_attribute
24132 #undef not_has_attribute
24133
24134 #undef float_size_of
24135 #undef bitnum_of
24136
24137 #undef def_common_attribute_with_nothing
24138 #undef def_special_attribute_with_nothing
24139
24140 #undef common_attribute_t
24141 #undef special_attribute_t
24142
24143 #undef enable_if
24144 #undef enabled_by_default
24145 #undef disabled_by_default
24146 #undef enable_if_not_ill_form
24147 #undef enable_flag
24148
24149 #undef was_an_ill_form
24150 #undef was_an_ill_form_with_parameter
24151 #undef was_not_an_ill_form
24152 #undef was_not_an_ill_form_and_noexcept
24153 #undef was_not_an_ill_form_with_parameter
24154
24155 #undef recursive_lambda
24156 #undef get_recursive_lambda_caller
24157 #undef lambda
24158 #undef lambda_with_catch
24159 #undef self_recursion
24160 #undef lambda_RLSRRS
24161
24162 #undef MAGIC
24163
24164 #undef nothing
24165
24166 #undef elseif
24167 #undef _big_than_
24168 #undef _small_than_
24169
24170 #if defined(_MSC_VER)
24171 #undef not
24172 #undef and
24173 #undef or
24174 #endif
24175
24176 #undef INTER_NAMESPACE
24177 #undef BREAK_NAMESPACE
24178
24179 #undef szie
24180 #undef form
24181
24182 #undef template_name
24183 #undef type_name
24184
24185 #undef not_in_debug
24186
24187 #undef es
24188 #undef ec
24189
24190 #undef ELC_TEST_EVENTNAME
24191
24192 #undef override_instance_struct
24193
24194 #undef distinctive
24195
24196 #undef force_inline
24197
24198 #undef with_no_vtable
24199
24200 #undef in_consteval
24201
24202 #undef no_vtable_struct
24203 #undef no_vtable_class
24204
24205 //file_end
24206
24207 #line 107 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/paths.hpp"
24208 }
24209 //
24210 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/APIs/_tools/undef_decl_system_type.hpp"
24211 //undef_decl_system_type.hpp
24212 /*
24213 未完成的elc解释器_share文件
24214 由steve02081504与Alex0125设计、编写
24215 转载时请在不对此文件做任何修改的同时注明出处
24216 项目地址:https://github.com/steve02081504/ELC
24217 */
24218 //copy&rewrite from steve02081504/evest.h
24219 #undef linux
24220 #undef windows
24221 #undef other
24222 #undef SYSTEM_TYPE
24223 #undef ERROR_MSG_UNABLE_OS
24224
24225 //file_end
24226
24227 #line 110 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/paths.hpp"
24228 #endif
24229
24230 //file_end
24231
24232 #line 15 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_body.hpp"
24233 namespace elc::defs{
24234 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
24235 //_defs.hpp
24236 /*
24237 未完成的elc解释器basic文件
24238 由steve02081504与Alex0125设计、编写
24239 转载时请在不对此文件做任何修改的同时注明出处
24240 项目地址:https://github.com/steve02081504/ELC
24241 */
24242 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
24243 //_defs.hpp
24244 /*
24245 未完成的elc解释器_share文件
24246 由steve02081504与Alex0125设计、编写
24247 转载时请在不对此文件做任何修改的同时注明出处
24248 项目地址:https://github.com/steve02081504/ELC
24249 */
24250
24251 //undefs at "_undefs.hpp"
24252
24253 //set ELC_WARNING_LEVEL default to 4(max)
24254 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
24255
24256 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
24257 //basic_environment.hpp
24258 /*
24259 未完成的elc解释器_share文件
24260 由steve02081504与Alex0125设计、编写
24261 转载时请在不对此文件做任何修改的同时注明出处
24262 项目地址:https://github.com/steve02081504/ELC
24263 */
24264
24265 //每个bit(不是字节)的可能性
24266 //为什么c艹委员会不定义这个?
24267 #define BIT_POSSIBILITY 2
24268
24269 //file_end
24270
24271 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
24272
24273 #if defined(_MSC_VER)
24274 #pragma warning(push,ELC_WARNING_LEVEL)
24275 #pragma warning(disable:4099)//class与struct混用警告diss
24276 #pragma warning(disable:26812)//enum class安利diss.
24277 #pragma warning(disable:4584)//重复子类警告diss
24278 #pragma warning(disable:4250)//域控制继承警告diss
24279 #pragma warning(disable:26432)//不完全默认方法警告diss
24280 #pragma warning(disable:26435)//virtual override方法警告diss
24281 #pragma warning(disable:26481)//容器安利diss
24282 #pragma warning(disable:26446)//gsl::at安利diss
24283 #pragma warning(disable:26434)//方法覆盖警告diss
24284 #pragma warning(disable:26429)//gsl::not_null安利diss
24285 #pragma warning(disable:26471)//对void*进行static_cast安利diss
24286 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
24287 #pragma warning(disable:26473)//相同指针显式cast警告diss
24288 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
24289 #pragma warning(disable:26485)//数组作指针警告diss
24290 #pragma warning(disable:26490)//reinterpret_cast警告diss
24291 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
24292 #pragma warning(disable:26482)//非常数数组索引警告diss
24293 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
24294 #endif
24295 #if defined(_MSC_VER)
24296 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
24297 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
24298 #define push_msvc_warning() __pragma(warning(push))
24299 #define pop_msvc_warning() __pragma(warning(pop))
24300 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
24301 #else
24302 #define suppress_msvc_warning(...)
24303 #define disable_msvc_warning(...)
24304 #define push_msvc_warning()
24305 #define pop_msvc_warning()
24306 #define push_and_disable_msvc_warning(...)
24307 #endif
24308 //
24309 #if defined(ELC_VOID_NAME)
24310 #undef void
24311 #endif
24312
24313 // #define often_noexcept
24314 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
24315 #define noexcept_as_auto MAGIC//哦现在有了
24316 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
24317 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
24318
24319 #define using_method_from_base_t(name,...) \
24320 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
24321 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
24322 {\
24323 return base_t::name(forward<Args>(rest)...);\
24324 }\
24325
24326 #define using_method_from_value(name,value_name,...) \
24327 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
24328 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
24329 {\
24330 return value_name.name(forward<Args>(rest)...);\
24331 }\
24332
24333 #define floop while(__builtin_is_my_dick_still_there())
24334 #define enable_adl(name) void name()noexcept=delete
24335
24336 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
24337 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
24338
24339 #define declvalue(...) (::std::declval<__VA_ARGS__>())
24340
24341 /*实例化到此将引发错误*/
24342 #define template_error(reason) static_assert(template_error_helper<T>,reason)
24343 /*实例化到此将引发警告*/
24344 #define template_warning(reason) template_warning_helper<T>(reason)
24345
24346 //for type_info
24347 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
24348 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
24349
24350 #define is_common_attribute(name) public attribute<T,name<T>>
24351 #define is_special_attribute(name) public attribute<T,name>
24352
24353 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
24354 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
24355
24356 //for float_size_t
24357 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
24358 //bitnum_of
24359 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
24360
24361 //for attribute
24362 #define def_common_attribute_with_nothing(name) \
24363 template<typename T>\
24364 class name{}\
24365
24366 #define def_special_attribute_with_nothing(name) \
24367 class name{}\
24368
24369 #define common_attribute_t template<class>class
24370 #define special_attribute_t class
24371
24372 /*
24373 若参数的布尔值为零,那么此模板不会实例化
24374
24375 为什么不用cpp20的constraints?
24376 1.不能类内定义
24377 2.不能作为模板参数
24378 一句话总结:c艹标准会sb
24379 */
24380 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
24381 /*默认参与模板候选*/
24382 #define enabled_by_default class enable_state=void
24383 /*默认不参与模板候选*/
24384 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
24385 /*若参数为病式,那么此模板不会实例化*/
24386 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
24387 /*用于模板声明*/
24388 #define enable_flag class enable_state
24389
24390 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
24391 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
24392 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
24393 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
24394 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
24395
24396 /*让lambda递归更加美观*/
24397 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
24398 /*让lambda递归更加美观*/
24399 #define get_recursive_lambda_caller(name) \
24400 lambda_with_catch(&)(auto&&...Args){\
24401 return name(name,Args...);\
24402 }
24403 /*让lambda定义更加美观*/
24404 #define lambda []
24405 /*让lambda定义更加美观*/
24406 #define lambda_with_catch(...) [__VA_ARGS__]
24407 /*让lambda递归更加美观*/
24408 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
24409 //recursive_lambda_self_referential_reserved_symbolname
24410 #define lambda_RLSRRS _my_jb_super_sb_name_
24411
24412 #define MAGIC//ahh,ko no tenno da!
24413
24414 /*装饰性语法糖*/
24415 #define nothing
24416
24417 /*aya风格语法糖*/
24418 #define elseif else if
24419 /*aya风格语法糖*/
24420 #define _big_than_ >
24421 /*aya风格语法糖*/
24422 #define _small_than_ <
24423
24424 #if defined(_MSC_VER)
24425 #define not !
24426 #define and &&
24427 #define or ||
24428 #endif
24429
24430 /*进入名称空间,并不是很美观*/
24431 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
24432 /*退出名称空间,并不是很美观*/
24433 #define BREAK_NAMESPACE }
24434
24435 /*template说明符*/
24436 #define template_name template
24437 /*template说明符*/
24438 #define type_name class
24439
24440 #if defined(DEBUG) || defined(_DEBUG)
24441 #define not_in_debug 0
24442 #else
24443 #define not_in_debug 1
24444 #endif
24445
24446 #define es U""
24447 #define ec(ch) U ## ch
24448
24449 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
24450 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
24451 #else
24452 #define ELC_TEST_EVENTNAME(name)
24453 #endif
24454
24455 #define override_instance_struct \
24456 protected:\
24457 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
24458 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
24459 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
24460 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
24461 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
24462
24463 #if defined(_WIN32)
24464 #define distinctive __declspec(dllexport)
24465 #else
24466 #define distinctive
24467 #endif
24468
24469 #if defined(_WIN32)
24470 #define force_inline __forceinline
24471 #elif defined(__GNUC__)
24472 #define force_inline __attribute__((always_inline)) inline
24473 #else
24474 #define force_inline inline
24475 #endif
24476
24477 #if defined(_WIN32)
24478 #define with_no_vtable __declspec(novtable)
24479 #else
24480 #define with_no_vtable
24481 #endif
24482
24483 #define in_consteval (::std::is_constant_evaluated())
24484
24485 #define no_vtable_struct struct with_no_vtable
24486 #define no_vtable_class class with_no_vtable
24487
24488 //file_end
24489
24490 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
24491
24492 //file_end
24493
24494 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_body.hpp"
24495
24496 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/package_symbol_loader.hpp"
24497 //package_symbol_loader.hpp
24498 /*
24499 未完成的elc解释器template文件
24500 由steve02081504与Alex0125设计、编写
24501 转载时请在不对此文件做任何修改的同时注明出处
24502 项目地址:https://github.com/steve02081504/ELC
24503 */
24504 namespace package_symbol_loader_n{
24506 library_handle_t package_symbol_loader_handle;
24507 function_t<ptr(string lib_name, size_t lib_ver, string symbol_name)noexcept> load_interface;
24508 function_t<ptr()noexcept> load_error_interface;
24509
24510 package_symbol_loader_t()noexcept{
24511 if(package_symbol_loader_handle = load_lib(paths::package_symbol_loader_path)){
24512 load_interface = package_symbol_loader_handle->get_symbol_as_function<ptr(string lib_name,size_t lib_ver,string symbol_name)noexcept>(es"load_interface");
24513 load_error_interface = package_symbol_loader_handle->get_symbol_as_function<ptr()noexcept>(es"load_error_interface");
24514 }
24515 else
24516 die_with(locale::str::package_symbol_loader::load_failed);
24517 if(!load_interface)
24518 die_with(locale::str::package_symbol_loader::load_interface_failed);
24519 }
24520 ~package_symbol_loader_t()noexcept = default;
24521
24522 ptr load_symbol(string lib_name,size_t lib_ver,string symbol_name)noexcept{
24523 return load_interface(lib_name,lib_ver,symbol_name);
24524 }
24525 ptr get_load_error()noexcept{
24526 return load_error_interface();
24527 }
24528 };
24529 }
24530
24531 //file_end
24532 #line 19 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_body.hpp"
24533 #if defined(ELC_TEST_ON)
24534 namespace package_symbol_loader_part_test{
24535 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_test.hpp"
24536 //_test.hpp
24537 /*
24538 未完成的elc解释器template文件
24539 由steve02081504与Alex0125设计、编写
24540 转载时请在不对此文件做任何修改的同时注明出处
24541 项目地址:https://github.com/steve02081504/ELC
24542 */
24543 inline void test(){
24544 ELC_TEST_EVENTNAME("package_symbol_loader部分测试");
24545 }
24546 inline void test_log_out(){}
24547 inline void test_end{}
24548
24549 //file_end
24550
24551 #line 22 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_body.hpp"
24552 }
24553 #endif
24554
24555 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
24556 //_undefs.hpp
24557 /*
24558 未完成的elc解释器basic文件
24559 由steve02081504与Alex0125设计、编写
24560 转载时请在不对此文件做任何修改的同时注明出处
24561 项目地址:https://github.com/steve02081504/ELC
24562 */
24563 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
24564 //_undefs.hpp
24565 /*
24566 未完成的elc解释器_share文件
24567 由steve02081504与Alex0125设计、编写
24568 转载时请在不对此文件做任何修改的同时注明出处
24569 项目地址:https://github.com/steve02081504/ELC
24570 */
24571
24572 //defs at "_defs.hpp"
24573
24574 #if defined(_MSC_VER)
24575 #pragma warning(pop)
24576 #endif
24577 #undef suppress_msvc_warning
24578 #undef disable_msvc_warning
24579 #undef push_msvc_warning
24580 #undef pop_msvc_warning
24581 #undef push_and_disable_msvc_warning
24582
24583 //for basic_environment.hpp
24584 #undef BIT_POSSIBILITY
24585 //
24586 #if defined(ELC_VOID_NAME)
24587 #define void the_void
24588 #endif
24589
24590 // #undef often_noexcept
24591 #undef noexcept_as
24592 #undef noexcept_as_auto
24593 #undef constexpr_as
24594 #undef constexpr_as_auto
24595
24596 #undef using_method_from_base_t
24597 #undef using_method_from_value
24598
24599 #undef floop
24600 #undef enable_adl
24601
24602 #undef re_declvalue
24603 #undef re_decltype
24604
24605 #undef declvalue
24606
24607 #undef template_error
24608 #undef template_warning
24609
24610 #undef type_info_of
24611 #undef type_name_of
24612
24613 #undef is_common_attribute
24614 #undef is_special_attribute
24615
24616 #undef has_attribute
24617 #undef not_has_attribute
24618
24619 #undef float_size_of
24620 #undef bitnum_of
24621
24622 #undef def_common_attribute_with_nothing
24623 #undef def_special_attribute_with_nothing
24624
24625 #undef common_attribute_t
24626 #undef special_attribute_t
24627
24628 #undef enable_if
24629 #undef enabled_by_default
24630 #undef disabled_by_default
24631 #undef enable_if_not_ill_form
24632 #undef enable_flag
24633
24634 #undef was_an_ill_form
24635 #undef was_an_ill_form_with_parameter
24636 #undef was_not_an_ill_form
24637 #undef was_not_an_ill_form_and_noexcept
24638 #undef was_not_an_ill_form_with_parameter
24639
24640 #undef recursive_lambda
24641 #undef get_recursive_lambda_caller
24642 #undef lambda
24643 #undef lambda_with_catch
24644 #undef self_recursion
24645 #undef lambda_RLSRRS
24646
24647 #undef MAGIC
24648
24649 #undef nothing
24650
24651 #undef elseif
24652 #undef _big_than_
24653 #undef _small_than_
24654
24655 #if defined(_MSC_VER)
24656 #undef not
24657 #undef and
24658 #undef or
24659 #endif
24660
24661 #undef INTER_NAMESPACE
24662 #undef BREAK_NAMESPACE
24663
24664 #undef szie
24665 #undef form
24666
24667 #undef template_name
24668 #undef type_name
24669
24670 #undef not_in_debug
24671
24672 #undef es
24673 #undef ec
24674
24675 #undef ELC_TEST_EVENTNAME
24676
24677 #undef override_instance_struct
24678
24679 #undef distinctive
24680
24681 #undef force_inline
24682
24683 #undef with_no_vtable
24684
24685 #undef in_consteval
24686
24687 #undef no_vtable_struct
24688 #undef no_vtable_class
24689
24690 //file_end
24691
24692 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
24693
24694 //file_end
24695
24696 #line 26 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_body.hpp"
24697 }
24698 namespace elc{
24699 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_export.hpp"
24700 //_export.hpp
24701 //at namespace elc
24702 /*
24703 未完成的elc解释器template文件
24704 由steve02081504与Alex0125设计、编写
24705 转载时请在不对此文件做任何修改的同时注明出处
24706 项目地址:https://github.com/steve02081504/ELC
24707 */
24708 #define export using defs::package_symbol_loader_n::
24709
24710 #undef export
24711
24712 //file_end
24713
24714 #line 29 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/package_symbol_loader/_body.hpp"
24715 }
24716
24717 //file_end
24718
24719 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/package_symbol_loader"
24720 #endif
24721
24722 //file_end
24723
24724 #line 23 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
24725 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/stream"
24726 //stream
24727 //at namespace ::
24728 /*
24729 未完成的elc解释器include文件
24730 由steve02081504与Alex0125设计、编写
24731 转载时请在不对此文件做任何修改的同时注明出处
24732 项目地址:https://github.com/steve02081504/ELC
24733 */
24734 #if !defined(ELC_STREAM)
24735 #define ELC_STREAM
24736 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
24737 //base
24738 //at namespace ::
24739 /*
24740 未完成的elc解释器include文件
24741 由steve02081504与Alex0125设计、编写
24742 转载时请在不对此文件做任何修改的同时注明出处
24743 项目地址:https://github.com/steve02081504/ELC
24744 */
24745 #line 18 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/base"
24746
24747 //file_end
24748
24749 #line 11 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/stream"
24750 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/stream/_body.hpp"
24751 //_body.hpp
24752 //at namespace ::
24753 /*
24754 未完成的elc解释器stream文件
24755 由steve02081504与Alex0125设计、编写
24756 转载时请在不对此文件做任何修改的同时注明出处
24757 项目地址:https://github.com/steve02081504/ELC
24758 */
24759 #if defined(ELC_TEST)
24760 #error "this part cannot be tested."
24761 #endif
24762 namespace elc::defs{
24763 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
24764 //_defs.hpp
24765 /*
24766 未完成的elc解释器basic文件
24767 由steve02081504与Alex0125设计、编写
24768 转载时请在不对此文件做任何修改的同时注明出处
24769 项目地址:https://github.com/steve02081504/ELC
24770 */
24771 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
24772 //_defs.hpp
24773 /*
24774 未完成的elc解释器_share文件
24775 由steve02081504与Alex0125设计、编写
24776 转载时请在不对此文件做任何修改的同时注明出处
24777 项目地址:https://github.com/steve02081504/ELC
24778 */
24779
24780 //undefs at "_undefs.hpp"
24781
24782 //set ELC_WARNING_LEVEL default to 4(max)
24783 #line 14 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
24784
24785 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/basic_environment.hpp"
24786 //basic_environment.hpp
24787 /*
24788 未完成的elc解释器_share文件
24789 由steve02081504与Alex0125设计、编写
24790 转载时请在不对此文件做任何修改的同时注明出处
24791 项目地址:https://github.com/steve02081504/ELC
24792 */
24793
24794 //每个bit(不是字节)的可能性
24795 //为什么c艹委员会不定义这个?
24796 #define BIT_POSSIBILITY 2
24797
24798 //file_end
24799
24800 #line 16 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_defs.hpp"
24801
24802 #if defined(_MSC_VER)
24803 #pragma warning(push,ELC_WARNING_LEVEL)
24804 #pragma warning(disable:4099)//class与struct混用警告diss
24805 #pragma warning(disable:26812)//enum class安利diss.
24806 #pragma warning(disable:4584)//重复子类警告diss
24807 #pragma warning(disable:4250)//域控制继承警告diss
24808 #pragma warning(disable:26432)//不完全默认方法警告diss
24809 #pragma warning(disable:26435)//virtual override方法警告diss
24810 #pragma warning(disable:26481)//容器安利diss
24811 #pragma warning(disable:26446)//gsl::at安利diss
24812 #pragma warning(disable:26434)//方法覆盖警告diss
24813 #pragma warning(disable:26429)//gsl::not_null安利diss
24814 #pragma warning(disable:26471)//对void*进行static_cast安利diss
24815 #pragma warning(disable:26474)//隐式指针转换显式cast警告diss
24816 #pragma warning(disable:26473)//相同指针显式cast警告diss
24817 #pragma warning(disable:26456)//隐藏非虚运算符警告diss
24818 #pragma warning(disable:26485)//数组作指针警告diss
24819 #pragma warning(disable:26490)//reinterpret_cast警告diss
24820 #pragma warning(disable:26472)//static_cast窄幅转换警告diss
24821 #pragma warning(disable:26482)//非常数数组索引警告diss
24822 #pragma warning(disable:26493)//c_cast转换警告diss:虽然有用但是太烦了,爬
24823 #endif
24824 #if defined(_MSC_VER)
24825 #define suppress_msvc_warning(...) __pragma(warning(suppress:__VA_ARGS__))
24826 #define disable_msvc_warning(...) __pragma(warning(disable:__VA_ARGS__))
24827 #define push_msvc_warning() __pragma(warning(push))
24828 #define pop_msvc_warning() __pragma(warning(pop))
24829 #define push_and_disable_msvc_warning(...) push_msvc_warning() disable_msvc_warning(__VA_ARGS__)
24830 #else
24831 #define suppress_msvc_warning(...)
24832 #define disable_msvc_warning(...)
24833 #define push_msvc_warning()
24834 #define pop_msvc_warning()
24835 #define push_and_disable_msvc_warning(...)
24836 #endif
24837 //
24838 #if defined(ELC_VOID_NAME)
24839 #undef void
24840 #endif
24841
24842 // #define often_noexcept
24843 #define noexcept_as(...) noexcept(noexcept((__VA_ARGS__)))//dnmd C艹标准就是没有noexcept_as_auto
24844 #define noexcept_as_auto MAGIC//哦现在有了
24845 #define constexpr_as(...) MAGIC constexpr//( •̀ ω •́ )✌
24846 #define constexpr_as_auto MAGIC MAGIC constexpr//✌( •̀ ω •́ )✌
24847
24848 #define using_method_from_base_t(name,...) \
24849 template<class...Args> requires was_not_an_ill_form(declvalue(base_t).name(declvalue(Args)...))\
24850 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(base_t::name(declvalue(Args)...))\
24851 {\
24852 return base_t::name(forward<Args>(rest)...);\
24853 }\
24854
24855 #define using_method_from_value(name,value_name,...) \
24856 template<class...Args> requires was_not_an_ill_form(re_declvalue(value_name).name(declvalue(Args)...))\
24857 auto name(Args&&...rest)__VA_ARGS__ noexcept_as(re_declvalue(value_name).name(declvalue(Args)...))\
24858 {\
24859 return value_name.name(forward<Args>(rest)...);\
24860 }\
24861
24862 #define floop while(__builtin_is_my_dick_still_there())
24863 #define enable_adl(name) void name()noexcept=delete
24864
24865 #define re_declvalue(...) (declvalue(decltype(__VA_ARGS__)))
24866 #define re_decltype(...) (decltype(declvalue(__VA_ARGS__)))
24867
24868 #define declvalue(...) (::std::declval<__VA_ARGS__>())
24869
24870 /*实例化到此将引发错误*/
24871 #define template_error(reason) static_assert(template_error_helper<T>,reason)
24872 /*实例化到此将引发警告*/
24873 #define template_warning(reason) template_warning_helper<T>(reason)
24874
24875 //for type_info
24876 #define type_info_of(...) base_type_info_t(typeid(__VA_ARGS__))
24877 #define type_name_of(...) (type_info_of(__VA_ARGS__).name())
24878
24879 #define is_common_attribute(name) public attribute<T,name<T>>
24880 #define is_special_attribute(name) public attribute<T,name>
24881
24882 #define has_attribute(...) template_name has_attribute_helper<__VA_ARGS__>()
24883 #define not_has_attribute(...) template_name not_has_has_attribute_helper<__VA_ARGS__>()
24884
24885 //for float_size_t
24886 #define float_size_of(...) (float_size_t{sizeof(__VA_ARGS__)})
24887 //bitnum_of
24888 #define bitnum_of(...) (bitnumof<__VA_ARGS__>)
24889
24890 //for attribute
24891 #define def_common_attribute_with_nothing(name) \
24892 template<typename T>\
24893 class name{}\
24894
24895 #define def_special_attribute_with_nothing(name) \
24896 class name{}\
24897
24898 #define common_attribute_t template<class>class
24899 #define special_attribute_t class
24900
24901 /*
24902 若参数的布尔值为零,那么此模板不会实例化
24903
24904 为什么不用cpp20的constraints?
24905 1.不能类内定义
24906 2.不能作为模板参数
24907 一句话总结:c艹标准会sb
24908 */
24909 #define enable_if(...) class enable_state= ::std::enable_if_t<__VA_ARGS__>
24910 /*默认参与模板候选*/
24911 #define enabled_by_default class enable_state=void
24912 /*默认不参与模板候选*/
24913 #define disabled_by_default class enable_state= ::std::enable_if_t<false>
24914 /*若参数为病式,那么此模板不会实例化*/
24915 #define enable_if_not_ill_form(...) class enable_state= ::std::void_t<decltype(__VA_ARGS__)>
24916 /*用于模板声明*/
24917 #define enable_flag class enable_state
24918
24919 #define was_an_ill_form(...) (!was_not_an_ill_form(__VA_ARGS__))
24920 #define was_an_ill_form_with_parameter(...) (!was_not_an_ill_form_with_parameter(__VA_ARGS__))
24921 #define was_not_an_ill_form(...) (bool(requires{__VA_ARGS__;}))
24922 #define was_not_an_ill_form_and_noexcept(...) (bool(requires{__VA_ARGS__;{__VA_ARGS__}noexcept;}))
24923 #define was_not_an_ill_form_with_parameter(...) (bool(requires __VA_ARGS__ ))
24924
24925 /*让lambda递归更加美观*/
24926 #define recursive_lambda(...) lambda(auto&&lambda_RLSRRS,__VA_ARGS__)
24927 /*让lambda递归更加美观*/
24928 #define get_recursive_lambda_caller(name) \
24929 lambda_with_catch(&)(auto&&...Args){\
24930 return name(name,Args...);\
24931 }
24932 /*让lambda定义更加美观*/
24933 #define lambda []
24934 /*让lambda定义更加美观*/
24935 #define lambda_with_catch(...) [__VA_ARGS__]
24936 /*让lambda递归更加美观*/
24937 #define self_recursion(...) lambda_RLSRRS(lambda_RLSRRS,__VA_ARGS__)
24938 //recursive_lambda_self_referential_reserved_symbolname
24939 #define lambda_RLSRRS _my_jb_super_sb_name_
24940
24941 #define MAGIC//ahh,ko no tenno da!
24942
24943 /*装饰性语法糖*/
24944 #define nothing
24945
24946 /*aya风格语法糖*/
24947 #define elseif else if
24948 /*aya风格语法糖*/
24949 #define _big_than_ >
24950 /*aya风格语法糖*/
24951 #define _small_than_ <
24952
24953 #if defined(_MSC_VER)
24954 #define not !
24955 #define and &&
24956 #define or ||
24957 #endif
24958
24959 /*进入名称空间,并不是很美观*/
24960 #define INTER_NAMESPACE(NAMESPACENAME) namespace NAMESPACENAME{
24961 /*退出名称空间,并不是很美观*/
24962 #define BREAK_NAMESPACE }
24963
24964 /*template说明符*/
24965 #define template_name template
24966 /*template说明符*/
24967 #define type_name class
24968
24969 #if defined(DEBUG) || defined(_DEBUG)
24970 #define not_in_debug 0
24971 #else
24972 #define not_in_debug 1
24973 #endif
24974
24975 #define es U""
24976 #define ec(ch) U ## ch
24977
24978 #if defined(ELC_TEST_ON)||defined(ELC_TEST_CHECK_MEMORY_LACK)
24979 #define ELC_TEST_EVENTNAME(name) stest_eventer _the_stest_eventer__(L""name)
24980 #else
24981 #define ELC_TEST_EVENTNAME(name)
24982 #endif
24983
24984 #define override_instance_struct \
24985 protected:\
24986 virtual void abstract_method_unget_this()noexcept_as(instance_struct<this_t>::abstract_method_unget_this())override{instance_struct<this_t>::abstract_method_unget_this();}\
24987 virtual void* _abstract_method_copy_get_this()noexcept_as(instance_struct<this_t>::_abstract_method_copy_get_this())override{return instance_struct<this_t>::_abstract_method_copy_get_this();}\
24988 virtual void* _abstract_method_get_resize_this(size_t size)noexcept_as(instance_struct<this_t>::instance_struct<this_t>::_abstract_method_get_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_resize_this(size);}\
24989 virtual void* _abstract_method_get_forward_resize_this(size_t size)noexcept_as(instance_struct<this_t>::_abstract_method_get_forward_resize_this(size))override{return instance_struct<this_t>::_abstract_method_get_forward_resize_this(size);}\
24990 virtual size_t abstract_method_get_size_of_get_for_this()noexcept override{return instance_struct<this_t>::abstract_method_get_size_of_get_for_this();}
24991
24992 #if defined(_WIN32)
24993 #define distinctive __declspec(dllexport)
24994 #else
24995 #define distinctive
24996 #endif
24997
24998 #if defined(_WIN32)
24999 #define force_inline __forceinline
25000 #elif defined(__GNUC__)
25001 #define force_inline __attribute__((always_inline)) inline
25002 #else
25003 #define force_inline inline
25004 #endif
25005
25006 #if defined(_WIN32)
25007 #define with_no_vtable __declspec(novtable)
25008 #else
25009 #define with_no_vtable
25010 #endif
25011
25012 #define in_consteval (::std::is_constant_evaluated())
25013
25014 #define no_vtable_struct struct with_no_vtable
25015 #define no_vtable_class class with_no_vtable
25016
25017 //file_end
25018
25019 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_defs.hpp"
25020
25021 //file_end
25022
25023 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/stream/_body.hpp"
25024
25025 #if defined(ELC_TEST_ON)
25026 namespace stream_part_test{
25027 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/stream/_test.hpp"
25028 //_test.hpp
25029 /*
25030 未完成的elc解释器stream文件
25031 由steve02081504与Alex0125设计、编写
25032 转载时请在不对此文件做任何修改的同时注明出处
25033 项目地址:https://github.com/steve02081504/ELC
25034 */
25035 inline void test(){
25036 ELC_TEST_EVENTNAME("stream部分测试");
25037 }
25038 inline void test_log_out(){
25039 }
25040 inline void test_end{
25041 }
25042
25043 //file_end
25044
25045 #line 17 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/stream/_body.hpp"
25046 }
25047 #endif
25048
25049 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
25050 //_undefs.hpp
25051 /*
25052 未完成的elc解释器basic文件
25053 由steve02081504与Alex0125设计、编写
25054 转载时请在不对此文件做任何修改的同时注明出处
25055 项目地址:https://github.com/steve02081504/ELC
25056 */
25057 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/../../../_share/_undefs.hpp"
25058 //_undefs.hpp
25059 /*
25060 未完成的elc解释器_share文件
25061 由steve02081504与Alex0125设计、编写
25062 转载时请在不对此文件做任何修改的同时注明出处
25063 项目地址:https://github.com/steve02081504/ELC
25064 */
25065
25066 //defs at "_defs.hpp"
25067
25068 #if defined(_MSC_VER)
25069 #pragma warning(pop)
25070 #endif
25071 #undef suppress_msvc_warning
25072 #undef disable_msvc_warning
25073 #undef push_msvc_warning
25074 #undef pop_msvc_warning
25075 #undef push_and_disable_msvc_warning
25076
25077 //for basic_environment.hpp
25078 #undef BIT_POSSIBILITY
25079 //
25080 #if defined(ELC_VOID_NAME)
25081 #define void the_void
25082 #endif
25083
25084 // #undef often_noexcept
25085 #undef noexcept_as
25086 #undef noexcept_as_auto
25087 #undef constexpr_as
25088 #undef constexpr_as_auto
25089
25090 #undef using_method_from_base_t
25091 #undef using_method_from_value
25092
25093 #undef floop
25094 #undef enable_adl
25095
25096 #undef re_declvalue
25097 #undef re_decltype
25098
25099 #undef declvalue
25100
25101 #undef template_error
25102 #undef template_warning
25103
25104 #undef type_info_of
25105 #undef type_name_of
25106
25107 #undef is_common_attribute
25108 #undef is_special_attribute
25109
25110 #undef has_attribute
25111 #undef not_has_attribute
25112
25113 #undef float_size_of
25114 #undef bitnum_of
25115
25116 #undef def_common_attribute_with_nothing
25117 #undef def_special_attribute_with_nothing
25118
25119 #undef common_attribute_t
25120 #undef special_attribute_t
25121
25122 #undef enable_if
25123 #undef enabled_by_default
25124 #undef disabled_by_default
25125 #undef enable_if_not_ill_form
25126 #undef enable_flag
25127
25128 #undef was_an_ill_form
25129 #undef was_an_ill_form_with_parameter
25130 #undef was_not_an_ill_form
25131 #undef was_not_an_ill_form_and_noexcept
25132 #undef was_not_an_ill_form_with_parameter
25133
25134 #undef recursive_lambda
25135 #undef get_recursive_lambda_caller
25136 #undef lambda
25137 #undef lambda_with_catch
25138 #undef self_recursion
25139 #undef lambda_RLSRRS
25140
25141 #undef MAGIC
25142
25143 #undef nothing
25144
25145 #undef elseif
25146 #undef _big_than_
25147 #undef _small_than_
25148
25149 #if defined(_MSC_VER)
25150 #undef not
25151 #undef and
25152 #undef or
25153 #endif
25154
25155 #undef INTER_NAMESPACE
25156 #undef BREAK_NAMESPACE
25157
25158 #undef szie
25159 #undef form
25160
25161 #undef template_name
25162 #undef type_name
25163
25164 #undef not_in_debug
25165
25166 #undef es
25167 #undef ec
25168
25169 #undef ELC_TEST_EVENTNAME
25170
25171 #undef override_instance_struct
25172
25173 #undef distinctive
25174
25175 #undef force_inline
25176
25177 #undef with_no_vtable
25178
25179 #undef in_consteval
25180
25181 #undef no_vtable_struct
25182 #undef no_vtable_class
25183
25184 //file_end
25185
25186 #line 8 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/_share/_undefs.hpp"
25187
25188 //file_end
25189
25190 #line 21 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/stream/_body.hpp"
25191 }
25192 namespace elc{
25193 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/stream/_export.hpp"
25194 //_export.hpp
25195 //at namespace elc
25196 /*
25197 未完成的elc解释器stream文件
25198 由steve02081504与Alex0125设计、编写
25199 转载时请在不对此文件做任何修改的同时注明出处
25200 项目地址:https://github.com/steve02081504/ELC
25201 */
25202 #define export using defs::
25203 #undef export
25204
25205 //file_end
25206
25207 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/_files/stream/_body.hpp"
25208 }
25209
25210 //file_end
25211
25212 #line 12 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/stream"
25213 #endif
25214
25215 //file_end
25216
25217 #line 24 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
25218 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
25219 //string
25220 //at namespace ::
25221 /*
25222 未完成的elc解释器include文件
25223 由steve02081504与Alex0125设计、编写
25224 转载时请在不对此文件做任何修改的同时注明出处
25225 项目地址:https://github.com/steve02081504/ELC
25226 */
25227 #line 13 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/string"
25228
25229 //file_end
25230
25231 #line 25 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
25232 //#include "test"
25233 #line 1 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/void_name"
25234 //void_name
25235 //at namespace ::
25236 /*
25237 未完成的elc解释器include文件
25238 由steve02081504与Alex0125设计、编写
25239 转载时请在不对此文件做任何修改的同时注明出处
25240 项目地址:https://github.com/steve02081504/ELC
25241 */
25242 #if !defined(ELC_VOID_NAME)
25243 #define ELC_VOID_NAME
25244 typedef void the_void;
25245 #define void the_void
25246 #endif
25247
25248 //file_end
25249
25250 #line 27 "https://github.com/ELC-lang/ELC/tree/master/parts/header_file/files/elc/all"
25251#endif
25252
25253//file_end
25254